mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-09-19 06:09:32 +02:00
Enable werror for javadoc and fix javadoc issues
This commit is contained in:
parent
4249c1a845
commit
1a3067c89b
|
@ -251,15 +251,9 @@ allprojects {
|
|||
// gradle.
|
||||
options.addStringOption('Xdoclint:all', '-quiet')
|
||||
|
||||
// TODO: Add
|
||||
|
||||
// Treat warnings as errors.
|
||||
// See also https://bugs.openjdk.java.net/browse/JDK-8200363
|
||||
// options.addStringOption('Xwerror', '-quiet')
|
||||
|
||||
// after all javadoc warnings have been resolved and
|
||||
// remove Xwerror from the subprojects build.gradle files
|
||||
// (e.g. smack-android-extensions).
|
||||
options.addStringOption('Xwerror', '-quiet')
|
||||
}
|
||||
}
|
||||
tasks.withType(Javadoc) {
|
||||
|
|
133
resources/fix-a-javadoc.sh
Executable file
133
resources/fix-a-javadoc.sh
Executable file
|
@ -0,0 +1,133 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# Pretty fancy method to get reliable the absolute path of a shell
|
||||
# script, *even if it is sourced*. Credits go to GreenFox on
|
||||
# stackoverflow: http://stackoverflow.com/a/12197518/194894
|
||||
pushd . > /dev/null
|
||||
SCRIPTDIR="${BASH_SOURCE[0]}";
|
||||
while([ -h "${SCRIPTDIR}" ]); do
|
||||
cd "`dirname "${SCRIPTDIR}"`"
|
||||
SCRIPTDIR="$(readlink "`basename "${SCRIPTDIR}"`")";
|
||||
done
|
||||
cd "`dirname "${SCRIPTDIR}"`" > /dev/null
|
||||
SCRIPTDIR="`pwd`";
|
||||
popd > /dev/null
|
||||
|
||||
SMACK_DIR=$(readlink "${SCRIPTDIR}"/..)
|
||||
|
||||
FIND_ALL_JAVA_SRC="find ${SMACK_DIR} \
|
||||
-type f \
|
||||
-name *.java \
|
||||
-print"
|
||||
|
||||
declare -A SMACK_EXCEPTIONS
|
||||
SMACK_EXCEPTIONS[NotConnectedException]="if the XMPP connection is not connected."
|
||||
SMACK_EXCEPTIONS[InterruptedException]="if the calling thread was interrupted."
|
||||
SMACK_EXCEPTIONS[XMPPErrorException]="if there was an XMPP error returned."
|
||||
SMACK_EXCEPTIONS[NoResponseException]="if there was no response from the remote entity."
|
||||
SMACK_EXCEPTIONS[NotLoggedInException]="if the XMPP connection is not authenticated."
|
||||
SMACK_EXCEPTIONS[BOSHException]="if an BOSH related error occured."
|
||||
SMACK_EXCEPTIONS[IOException]="if an I/O error occured."
|
||||
SMACK_EXCEPTIONS[SmackException]="if Smack detected an exceptional situation."
|
||||
SMACK_EXCEPTIONS[XMPPException]="if an XMPP protocol error was received."
|
||||
SMACK_EXCEPTIONS[SmackSaslException]="if a SASL specific error occured."
|
||||
SMACK_EXCEPTIONS[SASLErrorException]="if a SASL protocol error was returned."
|
||||
SMACK_EXCEPTIONS[NotAMucServiceException]="if the entity is not a MUC serivce."
|
||||
SMACK_EXCEPTIONS[NoSuchAlgorithmException]="if no such algorithm is available."
|
||||
SMACK_EXCEPTIONS[KeyManagementException]="if there was a key mangement error."
|
||||
SMACK_EXCEPTIONS[XmppStringprepException]="if the provided string is invalid."
|
||||
SMACK_EXCEPTIONS[XmlPullParserException]="if an error in the XML parser occured."
|
||||
SMACK_EXCEPTIONS[SmackParsingException]="if the Smack parser (provider) encountered invalid input."
|
||||
SMACK_EXCEPTIONS[MucNotJoinedException]="if not joined to the Multi-User Chat."
|
||||
SMACK_EXCEPTIONS[MucAlreadyJoinedException]="if already joined the Multi-User Chat."7y
|
||||
SMACK_EXCEPTIONS[NotALeafNodeException]="if a PubSub leaf node operation was attempted on a non-leaf node."
|
||||
SMACK_EXCEPTIONS[FeatureNotSupportedException]="if a requested feature is not supported by the remote entity."
|
||||
SMACK_EXCEPTIONS[MucConfigurationNotSupportedException]="if the requested MUC configuration is not supported by the MUC service."
|
||||
SMACK_EXCEPTIONS[CouldNotConnectToAnyProvidedSocks5Host]="if no connection to any provided stream host could be established"
|
||||
SMACK_EXCEPTIONS[NoSocks5StreamHostsProvided]="if no stream host was provided."
|
||||
SMACK_EXCEPTIONS[SmackMessageException]="if there was an error."
|
||||
SMACK_EXCEPTIONS[SecurityException]="if there was a security violation."
|
||||
SMACK_EXCEPTIONS[InvocationTargetException]="if a reflection-based method or constructor invocation threw."
|
||||
SMACK_EXCEPTIONS[IllegalArgumentException]="if an illegal argument was given."
|
||||
SMACK_EXCEPTIONS[NotAPubSubNodeException]="if a involved node is not a PubSub node."
|
||||
SMACK_EXCEPTIONS[NoAcceptableTransferMechanisms]="if no acceptable transfer mechanisms are available"
|
||||
SMACK_EXCEPTIONS[NoSuchMethodException]="if no such method is declared"
|
||||
SMACK_EXCEPTIONS[Exception]="if an exception occured."
|
||||
SMACK_EXCEPTIONS[TestNotPossibleException]="if the test is not possible."
|
||||
SMACK_EXCEPTIONS[TimeoutException]="if there was a timeout."
|
||||
SMACK_EXCEPTIONS[IllegalStateException]="if an illegal state was encountered"
|
||||
SMACK_EXCEPTIONS[NoSuchPaddingException]="if the requested padding mechanism is not availble."
|
||||
SMACK_EXCEPTIONS[BadPaddingException]="if the input data is not padded properly."
|
||||
SMACK_EXCEPTIONS[InvalidKeyException]="if the key is invalid."
|
||||
SMACK_EXCEPTIONS[IllegalBlockSizeException]="if the input data length is incorrect."
|
||||
SMACK_EXCEPTIONS[InvalidAlgorithmParameterException]="if the provided arguments are invalid."
|
||||
SMACK_EXCEPTIONS[CorruptedOmemoKeyException]="if the OMEMO key is corrupted."
|
||||
SMACK_EXCEPTIONS[CryptoFailedException]="if the OMEMO cryptography failed."
|
||||
SMACK_EXCEPTIONS[CannotEstablishOmemoSessionException]="if no OMEMO session could be established."
|
||||
SMACK_EXCEPTIONS[UntrustedOmemoIdentityException]="if the OMEMO identity is not trusted."
|
||||
|
||||
MODE=""
|
||||
|
||||
while getopts dm: OPTION "$@"; do
|
||||
case $OPTION in
|
||||
d)
|
||||
set -x
|
||||
;;
|
||||
m)
|
||||
MODE=${OPTARG}
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option ${OPTION}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
sed_sources() {
|
||||
sedScript=${1}
|
||||
${FIND_ALL_JAVA_SRC} |\
|
||||
xargs sed \
|
||||
--in-place \
|
||||
--follow-symlinks \
|
||||
--regexp-extended \
|
||||
"${sedScript}"
|
||||
}
|
||||
|
||||
show_affected() {
|
||||
echo ${!SMACK_EXCEPTIONS{@}}
|
||||
for exception in ${!SMACK_EXCEPTIONS[@]}; do
|
||||
${FIND_ALL_JAVA_SRC} |\
|
||||
xargs grep " \* @throws $exception$" || true
|
||||
done
|
||||
for exception in ${!SMACK_EXCEPTIONS[@]}; do
|
||||
count=$(${FIND_ALL_JAVA_SRC} |\
|
||||
xargs grep " \* @throws $exception$" | wc -l)
|
||||
echo "$exception $count"
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
fix_affected() {
|
||||
for exception in "${!SMACK_EXCEPTIONS[@]}"; do
|
||||
exceptionJavadoc=${SMACK_EXCEPTIONS[${exception}]}
|
||||
sed_sources "s;@throws ((\w*\.)?${exception})\$;@throws \1 ${exceptionJavadoc};"
|
||||
done
|
||||
}
|
||||
|
||||
add_todo_to_param_and_return() {
|
||||
sed_sources "s;@(param|return) (\w*)\$;@\1 \2 TODO javadoc me please;"
|
||||
}
|
||||
|
||||
case $MODE in
|
||||
show)
|
||||
show_affected
|
||||
;;
|
||||
fix)
|
||||
fix_affected
|
||||
;;
|
||||
*)
|
||||
echo "Unknown mode ${mode}"
|
||||
exit 1
|
||||
esac
|
|
@ -7,11 +7,3 @@ dependencies {
|
|||
compile project(':smack-android')
|
||||
compile project(':smack-extensions')
|
||||
}
|
||||
|
||||
if (JavaVersion.current().isJava8Compatible()) {
|
||||
tasks.withType(Javadoc) {
|
||||
// Treat warnings as errors.
|
||||
// See also https://bugs.openjdk.java.net/browse/JDK-8200363
|
||||
options.addStringOption('Xwerror', '-quiet')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -296,7 +296,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {
|
|||
* Send a HTTP request to the connection manager with the provided body element.
|
||||
*
|
||||
* @param body the body which will be sent.
|
||||
* @throws BOSHException
|
||||
* @throws BOSHException if an BOSH (Bidirectional-streams Over Synchronous HTTP, XEP-0124) related error occurs
|
||||
*/
|
||||
protected void send(ComposableBody body) throws BOSHException {
|
||||
if (!connected) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public class PacketReaderTest extends SmackTestCase {
|
|||
/**
|
||||
* Constructor for PacketReaderTest.
|
||||
*
|
||||
* @param arg0
|
||||
* @param arg0 TODO javadoc me please
|
||||
*/
|
||||
public PacketReaderTest(String arg0) {
|
||||
super(arg0);
|
||||
|
|
|
@ -38,7 +38,7 @@ public class RosterSmackTest extends SmackTestCase {
|
|||
|
||||
/**
|
||||
* Constructor for RosterSmackTest.
|
||||
* @param name
|
||||
* @param name TODO javadoc me please
|
||||
*/
|
||||
public RosterSmackTest(String name) {
|
||||
super(name);
|
||||
|
|
|
@ -24,7 +24,7 @@ public class MockPacket extends Packet {
|
|||
|
||||
/**
|
||||
* Returns null always.
|
||||
* @return null
|
||||
* @return null TODO javadoc me please
|
||||
*/
|
||||
public String toXML() {
|
||||
return null;
|
||||
|
|
|
@ -31,7 +31,7 @@ public class PrivacyProviderTest extends SmackTestCase {
|
|||
|
||||
/**
|
||||
* Constructor for PrivacyTest.
|
||||
* @param arg0
|
||||
* @param arg0 TODO javadoc me please
|
||||
*/
|
||||
public PrivacyProviderTest(String arg0) {
|
||||
super(arg0);
|
||||
|
|
|
@ -503,7 +503,7 @@ public abstract class SmackTestCase extends TestCase {
|
|||
/**
|
||||
* Subscribes all connections with each other: They all become friends
|
||||
*
|
||||
* @throws XMPPException
|
||||
* @throws XMPPException if an XMPP protocol error was received.
|
||||
*/
|
||||
protected void letsAllBeFriends() throws XMPPException {
|
||||
ConnectionUtils.letsAllBeFriends(connections);
|
||||
|
|
|
@ -488,9 +488,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
*
|
||||
* @throws XMPPException if an error occurs on the XMPP protocol level.
|
||||
* @throws SmackException if an error occurs somewhere else besides XMPP protocol level.
|
||||
* @throws IOException
|
||||
* @throws IOException if an I/O error occured.
|
||||
* @return a reference to this object, to chain <code>connect()</code> with <code>login()</code>.
|
||||
* @throws InterruptedException
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
public synchronized AbstractXMPPConnection connect() throws SmackException, IOException, XMPPException, InterruptedException {
|
||||
// Check if not already connected
|
||||
|
@ -528,10 +528,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
* way of XMPP connection establishment. Implementations are required to perform an automatic
|
||||
* login if the previous connection state was logged (authenticated).
|
||||
*
|
||||
* @throws SmackException
|
||||
* @throws IOException
|
||||
* @throws XMPPException
|
||||
* @throws InterruptedException
|
||||
* @throws SmackException if Smack detected an exceptional situation.
|
||||
* @throws IOException if an I/O error occured.
|
||||
* @throws XMPPException if an XMPP protocol error was received.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
protected abstract void connectInternal() throws SmackException, IOException, XMPPException, InterruptedException;
|
||||
|
||||
|
@ -563,7 +563,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
* @throws XMPPException if an error occurs on the XMPP protocol level.
|
||||
* @throws SmackException if an error occurs somewhere else besides XMPP protocol level.
|
||||
* @throws IOException if an I/O error occurs during login.
|
||||
* @throws InterruptedException
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
public synchronized void login() throws XMPPException, SmackException, IOException, InterruptedException {
|
||||
// The previously used username, password and resource take over precedence over the
|
||||
|
@ -578,12 +578,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
* Same as {@link #login(CharSequence, String, Resourcepart)}, but takes the resource from the connection
|
||||
* configuration.
|
||||
*
|
||||
* @param username
|
||||
* @param password
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws IOException
|
||||
* @throws InterruptedException
|
||||
* @param username TODO javadoc me please
|
||||
* @param password TODO javadoc me please
|
||||
* @throws XMPPException if an XMPP protocol error was received.
|
||||
* @throws SmackException if Smack detected an exceptional situation.
|
||||
* @throws IOException if an I/O error occured.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @see #login
|
||||
*/
|
||||
public synchronized void login(CharSequence username, String password) throws XMPPException, SmackException,
|
||||
|
@ -595,13 +595,13 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
* Login with the given username (authorization identity). You may omit the password if a callback handler is used.
|
||||
* If resource is null, then the server will generate one.
|
||||
*
|
||||
* @param username
|
||||
* @param password
|
||||
* @param resource
|
||||
* @throws XMPPException
|
||||
* @throws SmackException
|
||||
* @throws IOException
|
||||
* @throws InterruptedException
|
||||
* @param username TODO javadoc me please
|
||||
* @param password TODO javadoc me please
|
||||
* @param resource TODO javadoc me please
|
||||
* @throws XMPPException if an XMPP protocol error was received.
|
||||
* @throws SmackException if Smack detected an exceptional situation.
|
||||
* @throws IOException if an I/O error occured.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @see #login
|
||||
*/
|
||||
public synchronized void login(CharSequence username, String password, Resourcepart resource) throws XMPPException,
|
||||
|
@ -847,7 +847,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
* presence stanza with whatever data is set.
|
||||
*
|
||||
* @param unavailablePresence the optional presence stanza to send during shutdown.
|
||||
* @throws NotConnectedException
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
*/
|
||||
public synchronized void disconnect(Presence unavailablePresence) throws NotConnectedException {
|
||||
if (unavailablePresence != null) {
|
||||
|
@ -1277,7 +1277,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
* they are a match with the filter.
|
||||
*
|
||||
* @param stanza the stanza to process.
|
||||
* @throws InterruptedException
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
protected void processStanza(final Stanza stanza) throws InterruptedException {
|
||||
assert stanza != null;
|
||||
|
|
|
@ -40,8 +40,8 @@ public abstract class AbstractXmppNioConnection extends AbstractXmppStateMachine
|
|||
* Set the interest Ops of a SelectionKey. Since Java's NIO interestOps(int) can block at any time, we use a queue
|
||||
* to perform the actual operation in the reactor where we can perform this operation non-blocking.
|
||||
*
|
||||
* @param selectionKey
|
||||
* @param interestOps
|
||||
* @param selectionKey TODO javadoc me please
|
||||
* @param interestOps TODO javadoc me please
|
||||
*/
|
||||
protected void setInterestOps(SelectionKey selectionKey, int interestOps) {
|
||||
SMACK_REACTOR.setInterestOps(selectionKey, interestOps);
|
||||
|
|
|
@ -544,7 +544,7 @@ public abstract class ConnectionConfiguration {
|
|||
/**
|
||||
* Check if the given SASL mechansism is enabled in this connection configuration.
|
||||
*
|
||||
* @param saslMechanism
|
||||
* @param saslMechanism TODO javadoc me please
|
||||
* @return true if the given SASL mechanism is enabled, false otherwise.
|
||||
*/
|
||||
public boolean isEnabledSaslMechanism(String saslMechanism) {
|
||||
|
@ -642,8 +642,8 @@ public abstract class ConnectionConfiguration {
|
|||
* Although most services will follow that pattern.
|
||||
* </p>
|
||||
*
|
||||
* @param jid
|
||||
* @param password
|
||||
* @param jid TODO javadoc me please
|
||||
* @param password TODO javadoc me please
|
||||
* @return a reference to this builder.
|
||||
* @since 4.4.0
|
||||
*/
|
||||
|
@ -916,7 +916,7 @@ public abstract class ConnectionConfiguration {
|
|||
/**
|
||||
* Set the enabled SSL/TLS protocols.
|
||||
*
|
||||
* @param enabledSSLProtocols
|
||||
* @param enabledSSLProtocols TODO javadoc me please
|
||||
* @return a reference to this builder.
|
||||
*/
|
||||
public B setEnabledSSLProtocols(String[] enabledSSLProtocols) {
|
||||
|
@ -939,7 +939,7 @@ public abstract class ConnectionConfiguration {
|
|||
* Set the HostnameVerifier used to verify the hostname of SSLSockets used by XMPP connections
|
||||
* created with this ConnectionConfiguration.
|
||||
*
|
||||
* @param verifier
|
||||
* @param verifier TODO javadoc me please
|
||||
* @return a reference to this builder.
|
||||
*/
|
||||
public B setHostnameVerifier(HostnameVerifier verifier) {
|
||||
|
|
|
@ -61,7 +61,7 @@ public final class ReconnectionManager {
|
|||
/**
|
||||
* Get a instance of ReconnectionManager for the given connection.
|
||||
*
|
||||
* @param connection
|
||||
* @param connection TODO javadoc me please
|
||||
* @return a ReconnectionManager for the connection.
|
||||
*/
|
||||
public static synchronized ReconnectionManager getInstanceFor(AbstractXMPPConnection connection) {
|
||||
|
@ -90,7 +90,7 @@ public final class ReconnectionManager {
|
|||
* Set if the automatic reconnection mechanism will be enabled per default for new XMPP connections. The default is
|
||||
* 'false'.
|
||||
*
|
||||
* @param enabled
|
||||
* @param enabled TODO javadoc me please
|
||||
*/
|
||||
public static void setEnabledPerDefault(boolean enabled) {
|
||||
enabledPerDefault = enabled;
|
||||
|
@ -132,7 +132,7 @@ public final class ReconnectionManager {
|
|||
/**
|
||||
* Set the default Reconnection Policy to use.
|
||||
*
|
||||
* @param reconnectionPolicy
|
||||
* @param reconnectionPolicy TODO javadoc me please
|
||||
*/
|
||||
public static void setDefaultReconnectionPolicy(ReconnectionPolicy reconnectionPolicy) {
|
||||
defaultReconnectionPolicy = reconnectionPolicy;
|
||||
|
@ -173,7 +173,7 @@ public final class ReconnectionManager {
|
|||
/**
|
||||
* Set the Reconnection Policy to use.
|
||||
*
|
||||
* @param reconnectionPolicy
|
||||
* @param reconnectionPolicy TODO javadoc me please
|
||||
*/
|
||||
public void setReconnectionPolicy(ReconnectionPolicy reconnectionPolicy) {
|
||||
this.reconnectionPolicy = reconnectionPolicy;
|
||||
|
|
|
@ -183,13 +183,13 @@ public final class SASLAuthentication {
|
|||
* @param authzid the authorization identifier (typically null).
|
||||
* @param sslSession the optional SSL/TLS session (if one was established)
|
||||
* @return the used SASLMechanism.
|
||||
* @throws XMPPErrorException
|
||||
* @throws SASLErrorException
|
||||
* @throws IOException
|
||||
* @throws InterruptedException
|
||||
* @throws SmackSaslException
|
||||
* @throws NotConnectedException
|
||||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException if there was an XMPP error returned.
|
||||
* @throws SASLErrorException if a SASL protocol error was returned.
|
||||
* @throws IOException if an I/O error occured.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws SmackSaslException if a SASL specific error occured.
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
public SASLMechanism authenticate(String username, String password, EntityBareJid authzid, SSLSession sslSession)
|
||||
throws XMPPErrorException, SASLErrorException, IOException,
|
||||
|
@ -239,8 +239,8 @@ public final class SASLAuthentication {
|
|||
* to <code>false</code>.
|
||||
*
|
||||
* @param challenge a base64 encoded string representing the challenge.
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
* @throws SmackException if Smack detected an exceptional situation.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
public void challengeReceived(String challenge) throws SmackException, InterruptedException {
|
||||
challengeReceived(challenge, false);
|
||||
|
@ -254,9 +254,9 @@ public final class SASLAuthentication {
|
|||
*
|
||||
* @param challenge a base64 encoded string representing the challenge.
|
||||
* @param finalChallenge true if this is the last challenge send by the server within the success stanza
|
||||
* @throws SmackSaslException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws SmackSaslException if a SASL specific error occured.
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
public void challengeReceived(String challenge, boolean finalChallenge) throws SmackSaslException, NotConnectedException, InterruptedException {
|
||||
try {
|
||||
|
@ -271,8 +271,8 @@ public final class SASLAuthentication {
|
|||
* Notification message saying that SASL authentication was successful. The next step
|
||||
* would be to bind the resource.
|
||||
* @param success result of the authentication.
|
||||
* @throws SmackException
|
||||
* @throws InterruptedException
|
||||
* @throws SmackException if Smack detected an exceptional situation.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
public void authenticated(Success success) throws SmackException, InterruptedException {
|
||||
// RFC6120 6.3.10 "At the end of the authentication exchange, the SASL server (the XMPP
|
||||
|
|
|
@ -241,7 +241,7 @@ public final class SmackConfiguration {
|
|||
/**
|
||||
* Set the default parsing exception callback for all newly created connections.
|
||||
*
|
||||
* @param callback
|
||||
* @param callback TODO javadoc me please
|
||||
* @see ParsingExceptionCallback
|
||||
*/
|
||||
public static void setDefaultParsingExceptionCallback(ParsingExceptionCallback callback) {
|
||||
|
@ -265,13 +265,20 @@ public final class SmackConfiguration {
|
|||
/**
|
||||
* Get compression handlers.
|
||||
*
|
||||
* @return a list of compression handlers.
|
||||
* @deprecated use {@link #getCompressionHandlers()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
// TODO: Remove in Smack 4.4.
|
||||
public static List<XMPPInputOutputStream> getCompresionHandlers() {
|
||||
return getCompressionHandlers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get compression handlers.
|
||||
*
|
||||
* @return a list of compression handlers.
|
||||
*/
|
||||
public static List<XMPPInputOutputStream> getCompressionHandlers() {
|
||||
List<XMPPInputOutputStream> res = new ArrayList<>(compressionHandlers.size());
|
||||
for (XMPPInputOutputStream ios : compressionHandlers) {
|
||||
|
@ -310,7 +317,7 @@ public final class SmackConfiguration {
|
|||
* package is disabled (but can be manually enabled).
|
||||
* </p>
|
||||
*
|
||||
* @param className
|
||||
* @param className TODO javadoc me please
|
||||
*/
|
||||
public static void addDisabledSmackClass(String className) {
|
||||
disabledSmackClasses.add(className);
|
||||
|
|
|
@ -292,7 +292,7 @@ public abstract class SmackFuture<V, E extends Exception> implements Future<V>,
|
|||
* A simple version of InternalSmackFuture which implements isNonFatalException(E) as always returning
|
||||
* <code>false</code> method.
|
||||
*
|
||||
* @param <V>
|
||||
* @param <V> the return value of the future.
|
||||
*/
|
||||
public abstract static class SimpleInternalProcessStanzaSmackFuture<V, E extends Exception>
|
||||
extends InternalProcessStanzaSmackFuture<V, E> {
|
||||
|
|
|
@ -148,7 +148,7 @@ public final class StanzaCollector implements AutoCloseable {
|
|||
*
|
||||
* @param <P> type of the result stanza.
|
||||
* @return the next available packet.
|
||||
* @throws InterruptedException
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// TODO: Consider removing this method as it is hardly ever useful.
|
||||
|
@ -173,7 +173,7 @@ public final class StanzaCollector implements AutoCloseable {
|
|||
*
|
||||
* @param <P> type of the result stanza.
|
||||
* @return the next available packet.
|
||||
* @throws InterruptedException
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
public <P extends Stanza> P nextResult() throws InterruptedException {
|
||||
return nextResult(connection.getReplyTimeout());
|
||||
|
@ -189,7 +189,7 @@ public final class StanzaCollector implements AutoCloseable {
|
|||
* @param <P> type of the result stanza.
|
||||
* @param timeout the timeout in milliseconds.
|
||||
* @return the next available stanza or <code>null</code> on timeout or connection error.
|
||||
* @throws InterruptedException
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <P extends Stanza> P nextResult(long timeout) throws InterruptedException {
|
||||
|
@ -219,8 +219,8 @@ public final class StanzaCollector implements AutoCloseable {
|
|||
* @return the next available stanza.
|
||||
* @throws XMPPErrorException in case an error response was received.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @see #nextResultOrThrow(long)
|
||||
*/
|
||||
public <P extends Stanza> P nextResultOrThrow() throws NoResponseException, XMPPErrorException,
|
||||
|
@ -387,7 +387,7 @@ public final class StanzaCollector implements AutoCloseable {
|
|||
* Set the stanza filter used by this collector. If <code>null</code>, then all stanzas will
|
||||
* get collected by this collector.
|
||||
*
|
||||
* @param stanzaFilter
|
||||
* @param stanzaFilter TODO javadoc me please
|
||||
* @return a reference to this configuration.
|
||||
*/
|
||||
public Configuration setStanzaFilter(StanzaFilter stanzaFilter) {
|
||||
|
@ -399,7 +399,7 @@ public final class StanzaCollector implements AutoCloseable {
|
|||
* Set the maximum size of this collector, i.e. how many stanzas this collector will collect
|
||||
* before dropping old ones.
|
||||
*
|
||||
* @param size
|
||||
* @param size TODO javadoc me please
|
||||
* @return a reference to this configuration.
|
||||
*/
|
||||
public Configuration setSize(int size) {
|
||||
|
@ -411,7 +411,7 @@ public final class StanzaCollector implements AutoCloseable {
|
|||
* Set the collector which timeout for the next result is reset once this collector collects
|
||||
* a packet.
|
||||
*
|
||||
* @param collector
|
||||
* @param collector TODO javadoc me please
|
||||
* @return a reference to this configuration.
|
||||
*/
|
||||
public Configuration setCollectorToReset(StanzaCollector collector) {
|
||||
|
|
|
@ -48,9 +48,9 @@ public interface StanzaListener {
|
|||
* </p>
|
||||
*
|
||||
* @param packet the stanza to process.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotLoggedInException
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws NotLoggedInException if the XMPP connection is not authenticated.
|
||||
*/
|
||||
void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, NotLoggedInException;
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ public class SynchronizationPoint<E extends Exception> {
|
|||
/**
|
||||
* Check if this synchronization point is successful or wait the connections reply timeout.
|
||||
* @throws NoResponseException if there was no response marking the synchronization point as success or failed.
|
||||
* @throws InterruptedException
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @return <code>null</code> if synchronization point was successful, or the failure Exception.
|
||||
*/
|
||||
public Exception checkIfSuccessOrWait() throws NoResponseException, InterruptedException {
|
||||
|
@ -281,7 +281,7 @@ public class SynchronizationPoint<E extends Exception> {
|
|||
* {@link #reportSuccess()}, {@link #reportFailure()} and {@link #reportFailure(Exception)} will either set this
|
||||
* synchronization point to {@link State#Success} or {@link State#Failure}. If none of them is set after the
|
||||
* connections reply timeout, this method will set the state of {@link State#NoResponse}.
|
||||
* @throws InterruptedException
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
private void waitForConditionOrTimeout() throws InterruptedException {
|
||||
waitStart = System.currentTimeMillis();
|
||||
|
@ -324,7 +324,7 @@ public class SynchronizationPoint<E extends Exception> {
|
|||
* The exception is thrown, if state is one of 'Initial', 'NoResponse' or 'RequestSent'
|
||||
* </p>
|
||||
* @return <code>true</code> if synchronization point was successful, <code>false</code> on failure.
|
||||
* @throws NoResponseException
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
*/
|
||||
private Exception checkForResponse() throws NoResponseException {
|
||||
switch (state) {
|
||||
|
|
|
@ -183,7 +183,7 @@ public interface XMPPConnection {
|
|||
*
|
||||
* @param stanza the stanza to send.
|
||||
* @throws NotConnectedException if the connection is not connected.
|
||||
* @throws InterruptedException
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* */
|
||||
void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException;
|
||||
|
||||
|
@ -234,8 +234,8 @@ public interface XMPPConnection {
|
|||
* </p>
|
||||
*
|
||||
* @param nonza the Nonza to send.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
void sendNonza(Nonza nonza) throws NotConnectedException, InterruptedException;
|
||||
|
||||
|
@ -258,11 +258,12 @@ public interface XMPPConnection {
|
|||
* Send an IQ request and wait for the response.
|
||||
*
|
||||
* @param request the IQ request
|
||||
* @param <I> the type of the expected result IQ.
|
||||
* @return an IQ with type 'result'
|
||||
* @throws NoResponseException
|
||||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NoResponseException if there was no response from the remote entity.
|
||||
* @throws XMPPErrorException if there was an XMPP error returned.
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @since 4.3
|
||||
*/
|
||||
<I extends IQ> I sendIqRequestAndWaitForResponse(IQ request)
|
||||
|
@ -276,8 +277,8 @@ public interface XMPPConnection {
|
|||
*
|
||||
* @param request the IQ request to filter responses from
|
||||
* @return a new stanza collector.
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
*/
|
||||
StanzaCollector createStanzaCollectorAndSend(IQ request) throws NotConnectedException, InterruptedException;
|
||||
|
||||
|
@ -290,8 +291,8 @@ public interface XMPPConnection {
|
|||
* @param stanzaFilter the stanza filter to use.
|
||||
* @param stanza the stanza to send right after the collector got created
|
||||
* @return a new stanza collector.
|
||||
* @throws InterruptedException
|
||||
* @throws NotConnectedException
|
||||
* @throws InterruptedException if the calling thread was interrupted.
|
||||
* @throws NotConnectedException if the XMPP connection is not connected.
|
||||
*/
|
||||
StanzaCollector createStanzaCollectorAndSend(StanzaFilter stanzaFilter, Stanza stanza)
|
||||
throws NotConnectedException, InterruptedException;
|
||||
|
@ -498,7 +499,7 @@ public interface XMPPConnection {
|
|||
* Set the FromMode for this connection instance. Defines how the 'from' attribute of outgoing
|
||||
* stanzas should be populated by Smack.
|
||||
*
|
||||
* @param fromMode
|
||||
* @param fromMode TODO javadoc me please
|
||||
*/
|
||||
void setFromMode(FromMode fromMode);
|
||||
|
||||
|
@ -514,8 +515,8 @@ public interface XMPPConnection {
|
|||
* server, or <code>null</code> if the server doesn't support that feature.
|
||||
*
|
||||
* @param <F> {@link ExtensionElement} type of the feature.
|
||||
* @param element
|
||||
* @param namespace
|
||||
* @param element TODO javadoc me please
|
||||
* @param namespace TODO javadoc me please
|
||||
* @return a stanza extensions of the feature or <code>null</code>
|
||||
*/
|
||||
<F extends FullyQualifiedElement> F getFeature(String element, String namespace);
|
||||
|
@ -523,8 +524,8 @@ public interface XMPPConnection {
|
|||
/**
|
||||
* Return true if the server supports the given stream feature.
|
||||
*
|
||||
* @param element
|
||||
* @param namespace
|
||||
* @param element TODO javadoc me please
|
||||
* @param namespace TODO javadoc me please
|
||||
* @return true if the server supports the stream feature.
|
||||
*/
|
||||
boolean hasFeature(String element, String namespace);
|
||||
|
@ -552,6 +553,7 @@ public interface XMPPConnection {
|
|||
*
|
||||
* @param stanza the stanza to send.
|
||||
* @param replyFilter the filter used for the response stanza.
|
||||
* @param <S> the type of the stanza to send.
|
||||
* @return a SmackFuture for the response.
|
||||
*/
|
||||
<S extends Stanza> SmackFuture<S, Exception> sendAsync(S stanza, StanzaFilter replyFilter);
|
||||
|
@ -562,6 +564,7 @@ public interface XMPPConnection {
|
|||
* @param stanza the stanza to send.
|
||||
* @param replyFilter the filter used for the response stanza.
|
||||
* @param timeout the reply timeout in milliseconds.
|
||||
* @param <S> the type of the stanza to send.
|
||||
* @return a SmackFuture for the response.
|
||||
*/
|
||||
<S extends Stanza> SmackFuture<S, Exception> sendAsync(S stanza, StanzaFilter replyFilter, long timeout);
|
||||
|
@ -588,7 +591,7 @@ public interface XMPPConnection {
|
|||
/**
|
||||
* Convenience method for {@link #unregisterIQRequestHandler(String, String, org.jivesoftware.smack.packet.IQ.Type)}.
|
||||
*
|
||||
* @param iqRequestHandler
|
||||
* @param iqRequestHandler TODO javadoc me please
|
||||
* @return the previously registered IQ request handler or null.
|
||||
*/
|
||||
IQRequestHandler unregisterIQRequestHandler(IQRequestHandler iqRequestHandler);
|
||||
|
|
|
@ -86,17 +86,6 @@ public abstract class XMPPException extends Exception {
|
|||
*/
|
||||
private final Stanza request;
|
||||
|
||||
/**
|
||||
* Creates a new XMPPErrorException with the given builder.
|
||||
*
|
||||
* @param xmppErrorBuilder
|
||||
* @deprecated Use {@link #XMPPErrorException(Stanza, StanzaError)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public XMPPErrorException(StanzaError.Builder xmppErrorBuilder) {
|
||||
this(null, xmppErrorBuilder.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new XMPPErrorException with the XMPPError that was the root case of the exception.
|
||||
*
|
||||
|
|
|
@ -76,7 +76,7 @@ public class Java7ZlibInputOutputStream extends XMPPInputOutputStream {
|
|||
* byte without blocking, 0 means that the system is known to block for more input.
|
||||
*
|
||||
* @return 0 if no data is available, 1 otherwise
|
||||
* @throws IOException
|
||||
* @throws IOException if an I/O error occured.
|
||||
*/
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
|
|
|
@ -30,7 +30,7 @@ public abstract class XMPPInputOutputStream {
|
|||
* Only use sync flush if you fully understand the implications.
|
||||
*
|
||||
* @see <a href="https://blog.thijsalkema.de/blog/2014/08/07/https-attacks-and-xmpp-2-crime-and-breach/">Attacks against XMPP when using compression</a>
|
||||
* @param flushMethod
|
||||
* @param flushMethod TODO javadoc me please
|
||||
*/
|
||||
public static void setFlushMethod(FlushMethod flushMethod) {
|
||||
XMPPInputOutputStream.flushMethod = flushMethod;
|
||||
|
|
|
@ -36,7 +36,7 @@ public abstract class AbstractFromToMatchesFilter implements StanzaFilter {
|
|||
*
|
||||
* @param address The address to filter for. If <code>null</code> is given, then
|
||||
* {@link #getAddressToCompare(Stanza)} must also return <code>null</code> to match.
|
||||
* @param ignoreResourcepart
|
||||
* @param ignoreResourcepart TODO javadoc me please
|
||||
*/
|
||||
protected AbstractFromToMatchesFilter(Jid address, boolean ignoreResourcepart) {
|
||||
if (address != null && ignoreResourcepart) {
|
||||
|
|
|
@ -39,7 +39,7 @@ public final class FromMatchesFilter extends AbstractFromToMatchesFilter {
|
|||
*
|
||||
* @param address The address to filter for. If <code>null</code> is given, the stanza must not
|
||||
* have a from address.
|
||||
* @param ignoreResourcepart
|
||||
* @param ignoreResourcepart TODO javadoc me please
|
||||
*/
|
||||
public FromMatchesFilter(Jid address, boolean ignoreResourcepart) {
|
||||
super(address, ignoreResourcepart);
|
||||
|
|
|
@ -61,7 +61,7 @@ public class PacketExtensionFilter implements StanzaFilter {
|
|||
/**
|
||||
* Creates a new stanza extension filter for the given stanza extension.
|
||||
*
|
||||
* @param packetExtension
|
||||
* @param packetExtension TODO javadoc me please
|
||||
*/
|
||||
public PacketExtensionFilter(ExtensionElement packetExtension) {
|
||||
this(packetExtension.getElementName(), packetExtension.getNamespace());
|
||||
|
|
|
@ -59,7 +59,7 @@ public class StanzaExtensionFilter implements StanzaFilter {
|
|||
/**
|
||||
* Creates a new stanza extension filter for the given stanza extension.
|
||||
*
|
||||
* @param packetExtension
|
||||
* @param packetExtension TODO javadoc me please
|
||||
*/
|
||||
public StanzaExtensionFilter(ExtensionElement packetExtension) {
|
||||
this(packetExtension.getElementName(), packetExtension.getNamespace());
|
||||
|
|
|
@ -431,6 +431,7 @@ public abstract class AbstractXmppStateMachineConnection extends AbstractXMPPCon
|
|||
/**
|
||||
* Check if the state should be activated.
|
||||
*
|
||||
* @param walkStateGraphContext the context of the current state graph walk.
|
||||
* @return <code>null</code> if the state should be activated.
|
||||
* @throws SmackException in case a Smack exception occurs.
|
||||
*/
|
||||
|
|
|
@ -252,14 +252,6 @@ public abstract class IQ extends Stanza {
|
|||
*/
|
||||
protected abstract IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #initializeAsResultFor(IQ)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
protected final void initialzeAsResultFor(IQ request) {
|
||||
initializeAsResultFor(request);
|
||||
}
|
||||
|
||||
protected final void initializeAsResultFor(IQ request) {
|
||||
assert this != request;
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ import org.jxmpp.stringprep.XmppStringprepException;
|
|||
* </ul>
|
||||
*
|
||||
* For each message type, different message fields are typically used as follows:
|
||||
* <p>
|
||||
* <table border="1">
|
||||
* <caption>Message Types</caption>
|
||||
* <tr><td> </td><td colspan="5"><b>Message type</b></td></tr>
|
||||
|
@ -120,8 +119,8 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
/**
|
||||
* Creates a new message with the specified recipient and extension element.
|
||||
*
|
||||
* @param to
|
||||
* @param extensionElement
|
||||
* @param to TODO javadoc me please
|
||||
* @param extensionElement TODO javadoc me please
|
||||
* @since 4.2
|
||||
*/
|
||||
public Message(Jid to, ExtensionElement extensionElement) {
|
||||
|
@ -136,7 +135,7 @@ public final class Message extends Stanza implements TypedCloneable<Message> {
|
|||
* instance.
|
||||
* </p>
|
||||
*
|
||||
* @param other
|
||||
* @param other TODO javadoc me please
|
||||
*/
|
||||
public Message(Message other) {
|
||||
super(other);
|
||||
|
|
|
@ -56,7 +56,7 @@ public interface Packet extends TopLevelStreamElement {
|
|||
|
||||
/**
|
||||
* Set the stanza ID.
|
||||
* @param packetID
|
||||
* @param packetID TODO javadoc me please
|
||||
* @deprecated use {@link #setStanzaId(String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
|
@ -195,8 +195,8 @@ public interface Packet extends TopLevelStreamElement {
|
|||
* The argument <code>elementName</code> may be null.
|
||||
* </p>
|
||||
*
|
||||
* @param elementName
|
||||
* @param namespace
|
||||
* @param elementName TODO javadoc me please
|
||||
* @param namespace TODO javadoc me please
|
||||
* @return true if a stanza extension exists, false otherwise.
|
||||
*/
|
||||
boolean hasExtension(String elementName, String namespace);
|
||||
|
@ -204,7 +204,7 @@ public interface Packet extends TopLevelStreamElement {
|
|||
/**
|
||||
* Check if a stanza extension with the given namespace exists.
|
||||
*
|
||||
* @param namespace
|
||||
* @param namespace TODO javadoc me please
|
||||
* @return true if a stanza extension exists, false otherwise.
|
||||
*/
|
||||
boolean hasExtension(String namespace);
|
||||
|
@ -212,8 +212,8 @@ public interface Packet extends TopLevelStreamElement {
|
|||
/**
|
||||
* Remove the stanza extension with the given elementName and namespace.
|
||||
*
|
||||
* @param elementName
|
||||
* @param namespace
|
||||
* @param elementName TODO javadoc me please
|
||||
* @param namespace TODO javadoc me please
|
||||
* @return the removed stanza extension or null.
|
||||
*/
|
||||
ExtensionElement removeExtension(String elementName, String namespace);
|
||||
|
|
|
@ -124,7 +124,7 @@ public final class Presence extends Stanza implements TypedCloneable<Presence> {
|
|||
* instance.
|
||||
* </p>
|
||||
*
|
||||
* @param other
|
||||
* @param other TODO javadoc me please
|
||||
*/
|
||||
public Presence(Presence other) {
|
||||
super(other);
|
||||
|
|
|
@ -130,7 +130,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
|||
|
||||
/**
|
||||
* Set the stanza ID.
|
||||
* @param packetID
|
||||
* @param packetID TODO javadoc me please
|
||||
* @deprecated use {@link #setStanzaId(String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
|
@ -422,8 +422,8 @@ public abstract class Stanza implements TopLevelStreamElement {
|
|||
* The argument <code>elementName</code> may be null.
|
||||
* </p>
|
||||
*
|
||||
* @param elementName
|
||||
* @param namespace
|
||||
* @param elementName TODO javadoc me please
|
||||
* @param namespace TODO javadoc me please
|
||||
* @return true if a stanza extension exists, false otherwise.
|
||||
*/
|
||||
public boolean hasExtension(String elementName, String namespace) {
|
||||
|
@ -439,7 +439,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
|||
/**
|
||||
* Check if a stanza extension with the given namespace exists.
|
||||
*
|
||||
* @param namespace
|
||||
* @param namespace TODO javadoc me please
|
||||
* @return true if a stanza extension exists, false otherwise.
|
||||
*/
|
||||
public boolean hasExtension(String namespace) {
|
||||
|
@ -456,8 +456,8 @@ public abstract class Stanza implements TopLevelStreamElement {
|
|||
/**
|
||||
* Remove the stanza extension with the given elementName and namespace.
|
||||
*
|
||||
* @param elementName
|
||||
* @param namespace
|
||||
* @param elementName TODO javadoc |