Fix minor codestyle issues

chatStatesChat2
Paul Schaub 5 years ago committed by Florian Schmaus
parent 200f90ffdc
commit cb18056613
  1. 8
      smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java
  2. 2
      smack-core/src/main/java/org/jivesoftware/smack/ConnectionCreationListener.java
  3. 14
      smack-core/src/main/java/org/jivesoftware/smack/ConnectionListener.java
  4. 2
      smack-core/src/main/java/org/jivesoftware/smack/ExceptionCallback.java
  5. 2
      smack-core/src/main/java/org/jivesoftware/smack/Manager.java
  6. 4
      smack-core/src/main/java/org/jivesoftware/smack/ReconnectionListener.java
  7. 2
      smack-core/src/main/java/org/jivesoftware/smack/ReconnectionManager.java
  8. 14
      smack-core/src/main/java/org/jivesoftware/smack/SASLAuthentication.java
  9. 14
      smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java
  10. 2
      smack-core/src/main/java/org/jivesoftware/smack/SmackException.java
  11. 5
      smack-core/src/main/java/org/jivesoftware/smack/SmackInitialization.java
  12. 2
      smack-core/src/main/java/org/jivesoftware/smack/StanzaCollector.java
  13. 2
      smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java
  14. 2
      smack-core/src/main/java/org/jivesoftware/smack/SuccessCallback.java
  15. 2
      smack-core/src/main/java/org/jivesoftware/smack/XMPPConnectionRegistry.java
  16. 5
      smack-core/src/main/java/org/jivesoftware/smack/filter/EmptyToMatcher.java
  17. 2
      smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaFilter.java
  18. 2
      smack-core/src/main/java/org/jivesoftware/smack/initializer/SmackInitializer.java
  19. 12
      smack-core/src/main/java/org/jivesoftware/smack/iqrequest/IQRequestHandler.java
  20. 2
      smack-core/src/main/java/org/jivesoftware/smack/packet/Element.java
  21. 2
      smack-core/src/main/java/org/jivesoftware/smack/packet/EmptyResultIQ.java
  22. 2
      smack-core/src/main/java/org/jivesoftware/smack/packet/ExtensionElement.java
  23. 2
      smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java
  24. 2
      smack-core/src/main/java/org/jivesoftware/smack/packet/NamedElement.java
  25. 50
      smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java
  26. 4
      smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java
  27. 2
      smack-core/src/main/java/org/jivesoftware/smack/parsing/ParsingExceptionCallback.java
  28. 10
      smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java
  29. 2
      smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java
  30. 2
      smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java
  31. 2
      smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxySocketConnection.java
  32. 2
      smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks4ProxySocketConnection.java
  33. 4
      smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramMechanism.java
  34. 2
      smack-core/src/main/java/org/jivesoftware/smack/util/Async.java
  35. 2
      smack-core/src/main/java/org/jivesoftware/smack/util/ByteUtils.java
  36. 2
      smack-core/src/main/java/org/jivesoftware/smack/util/LazyStringBuilder.java
  37. 8
      smack-core/src/main/java/org/jivesoftware/smack/util/ObservableWriter.java
  38. 8
      smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
  39. 2
      smack-core/src/main/java/org/jivesoftware/smack/util/PacketUtil.java
  40. 12
      smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java
  41. 2
      smack-core/src/main/java/org/jivesoftware/smack/util/ReaderListener.java
  42. 2
      smack-core/src/main/java/org/jivesoftware/smack/util/StringTransformer.java
  43. 4
      smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
  44. 2
      smack-core/src/main/java/org/jivesoftware/smack/util/TLSUtils.java
  45. 2
      smack-core/src/main/java/org/jivesoftware/smack/util/TypedCloneable.java
  46. 2
      smack-core/src/main/java/org/jivesoftware/smack/util/WriterListener.java
  47. 8
      smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java
  48. 2
      smack-core/src/main/java/org/jivesoftware/smack/util/dns/HostAddress.java
  49. 4
      smack-core/src/main/java/org/jivesoftware/smack/util/dns/SRVRecord.java
  50. 4
      smack-core/src/test/java/org/jivesoftware/smack/StanzaCollectorTest.java
  51. 4
      smack-core/src/test/java/org/jivesoftware/smack/ThreadedDummyConnection.java
  52. 2
      smack-core/src/test/java/org/jivesoftware/smack/packet/MessageTest.java
  53. 2
      smack-core/src/test/java/org/jivesoftware/smack/parsing/ParsingExceptionTest.java
  54. 3
      smack-core/src/test/java/org/jivesoftware/smack/sasl/DigestMd5SaslTest.java
  55. 47
      smack-core/src/test/java/org/jivesoftware/smack/test/util/CharSequenceEquals.java
  56. 2
      smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java
  57. 6
      smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java
  58. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/CarbonExtension.java
  59. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/eme/element/ExplicitMessageEncryptionElement.java
  60. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/AbstractHttpOverXmpp.java
  61. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/ThingControlRequest.java
  62. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/element/IoTSetResponse.java
  63. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/element/SetData.java
  64. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/ThingMomentaryReadOutRequest.java
  65. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/ThingMomentaryReadOutResult.java
  66. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTDataRequest.java
  67. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/ThingStateChangeListener.java
  68. 2
      smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/element/Tag.java
  69. 8
      smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/IoTProvisioningManager.java
  70. 10
      smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java
  71. 8
      smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLight.java
  72. 18
      smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java
  73. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/ExperimentalInitializerTest.java
  74. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/carbons/CarbonTest.java
  75. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/chat_markers/AcknowledgedExtensionTest.java
  76. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/chat_markers/DisplayedExtensionTest.java
  77. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/chat_markers/MarkableExtensionTest.java
  78. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/chat_markers/ReceivedExtensionTest.java
  79. 3
      smack-experimental/src/test/java/org/jivesoftware/smackx/hoxt/provider/HttpOverXmppReqProviderTest.java
  80. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/httpfileupload/FileTooLargeErrorCreateTest.java
  81. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/httpfileupload/SlotCreateTest.java
  82. 4
      smack-experimental/src/test/java/org/jivesoftware/smackx/httpfileupload/SlotRequestCreateTest.java
  83. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/httpfileupload/provider/FileTooLargeErrorProviderTest.java
  84. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamFinProviderTest.java
  85. 18
      smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamPrefIQProviderTest.java
  86. 8
      smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamQueryIQProviderTest.java
  87. 14
      smack-experimental/src/test/java/org/jivesoftware/smackx/mam/MamResultProviderTest.java
  88. 4
      smack-experimental/src/test/java/org/jivesoftware/smackx/mam/PreferencesTest.java
  89. 4
      smack-experimental/src/test/java/org/jivesoftware/smackx/mam/QueryArchiveTest.java
  90. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/mam/ResultsLimitTest.java
  91. 12
      smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightAffiliationsChangeExtensionTest.java
  92. 12
      smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightBlockingTest.java
  93. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightChangeAffiliationsIQTest.java
  94. 12
      smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightConfigurationsChangeExtensionTest.java
  95. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightCreateIQTest.java
  96. 2
      smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightDestroyTest.java
  97. 6
      smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightGetAffiliationsTest.java
  98. 10
      smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightGetConfigsTest.java
  99. 8
      smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightInfoTest.java
  100. 6
      smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightSetConfigsIQTest.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -341,7 +341,7 @@ public abstract class ConnectionConfiguration {
* An enumeration for TLS security modes that are available when making a connection
* to the XMPP server.
*/
public static enum SecurityMode {
public enum SecurityMode {
/**
* Security via TLS encryption is required in order to connect. If the server
@ -492,7 +492,7 @@ public abstract class ConnectionConfiguration {
* <p>
* This is an abstract class that uses the builder design pattern and the "getThis() trick" to recover the type of
* the builder in a class hierarchies with a self-referential generic supertype. Otherwise chaining of build
* instructions from the superclasses followed by build instructions of a sublcass would not be possible, because
* instructions from the superclasses followed by build instructions of a subclass would not be possible, because
* the superclass build instructions would return the builder of the superclass and not the one of the subclass. You
* can read more about it a Angelika Langer's Generics FAQ, especially the entry <a
* href="http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ206">What is the
@ -646,7 +646,7 @@ public abstract class ConnectionConfiguration {
public B setPort(int port) {
if (port < 0 || port > 65535) {
throw new IllegalArgumentException(
"Port must be a 16-bit unsiged integer (i.e. between 0-65535. Port was: " + port);
"Port must be a 16-bit unsigned integer (i.e. between 0-65535. Port was: " + port);
}
this.port = port;
return getThis();
@ -930,7 +930,7 @@ public abstract class ConnectionConfiguration {
Set<String> blacklistedMechanisms = SASLAuthentication.getBlacklistedSASLMechanisms();
for (String mechanism : saslMechanisms) {
if (!SASLAuthentication.isSaslMechanismRegistered(mechanism)) {
throw new IllegalArgumentException("SASL " + mechanism + " is not avaiable. Consider registering it with Smack");
throw new IllegalArgumentException("SASL " + mechanism + " is not available. Consider registering it with Smack");
}
if (blacklistedMechanisms.contains(mechanism)) {
throw new IllegalArgumentException("SALS " + mechanism + " is blacklisted.");

@ -33,6 +33,6 @@ public interface ConnectionCreationListener {
*
* @param connection the newly created connection.
*/
public void connectionCreated(XMPPConnection connection);
void connectionCreated(XMPPConnection connection);
}

@ -37,7 +37,7 @@ public interface ConnectionListener {
*
* @param connection the XMPPConnection which successfully connected to its endpoint.
*/
public void connected(XMPPConnection connection);
void connected(XMPPConnection connection);
/**
* Notification that the connection has been authenticated.
@ -45,12 +45,12 @@ public interface ConnectionListener {
* @param connection the XMPPConnection which successfully authenticated.
* @param resumed true if a previous XMPP session's stream was resumed.
*/
public void authenticated(XMPPConnection connection, boolean resumed);
void authenticated(XMPPConnection connection, boolean resumed);
/**
* Notification that the connection was closed normally.
*/
public void connectionClosed();
void connectionClosed();
/**
* Notification that the connection was closed due to an exception. When
@ -59,7 +59,7 @@ public interface ConnectionListener {
*
* @param e the exception.
*/
public void connectionClosedOnError(Exception e);
void connectionClosedOnError(Exception e);
/**
* The connection has reconnected successfully to the server. Connections will
@ -68,7 +68,7 @@ public interface ConnectionListener {
*/
// TODO: Remove in Smack 4.3
@Deprecated
public void reconnectionSuccessful();
void reconnectionSuccessful();
// The next two methods *must* only be invoked by ReconnectionManager
@ -83,7 +83,7 @@ public interface ConnectionListener {
*/
// TODO: Remove in Smack 4.3
@Deprecated
public void reconnectingIn(int seconds);
void reconnectingIn(int seconds);
/**
* An attempt to connect to the server has failed. The connection will keep trying reconnecting to the server in a
@ -97,5 +97,5 @@ public interface ConnectionListener {
*/
// TODO: Remove in Smack 4.3
@Deprecated
public void reconnectionFailed(Exception e);
void reconnectionFailed(Exception e);
}

@ -18,6 +18,6 @@ package org.jivesoftware.smack;
public interface ExceptionCallback {
public void processException(Exception exception);
void processException(Exception exception);
}

@ -28,7 +28,7 @@ public abstract class Manager {
public Manager(XMPPConnection connection) {
Objects.requireNonNull(connection, "XMPPConnection must not be null");
weakConnection = new WeakReference<XMPPConnection>(connection);
weakConnection = new WeakReference<>(connection);
}
protected final XMPPConnection connection() {

@ -34,7 +34,7 @@ public interface ReconnectionListener {
*
* @param seconds remaining seconds before attempting a reconnection.
*/
public void reconnectingIn(int seconds);
void reconnectingIn(int seconds);
/**
* An attempt to connect to the server has failed. The connection will keep trying reconnecting to the server in a
@ -46,5 +46,5 @@ public interface ReconnectionListener {
*
* @param e the exception that caused the reconnection to fail.
*/
public void reconnectionFailed(Exception e);
void reconnectionFailed(Exception e);
}

@ -189,7 +189,7 @@ public final class ReconnectionManager {
private Thread reconnectionThread;
private ReconnectionManager(AbstractXMPPConnection connection) {
weakRefConnection = new WeakReference<AbstractXMPPConnection>(connection);
weakRefConnection = new WeakReference<>(connection);
reconnectionRunnable = new Runnable() {

@ -64,9 +64,9 @@ public final class SASLAuthentication {
private static final Logger LOGGER = Logger.getLogger(SASLAuthentication.class.getName());
private static final List<SASLMechanism> REGISTERED_MECHANISMS = new ArrayList<SASLMechanism>();
private static final List<SASLMechanism> REGISTERED_MECHANISMS = new ArrayList<>();
private static final Set<String> BLACKLISTED_MECHANISMS = new HashSet<String>();
private static final Set<String> BLACKLISTED_MECHANISMS = new HashSet<>();
static {
// Blacklist SCRAM-SHA-1-PLUS for now.
@ -91,7 +91,7 @@ public final class SASLAuthentication {
* @return the registered SASLMechanism sorted by the level of preference.
*/
public static Map<String, String> getRegisterdSASLMechanisms() {
Map<String, String> answer = new LinkedHashMap<String, String>();
Map<String, String> answer = new LinkedHashMap<>();
synchronized (REGISTERED_MECHANISMS) {
for (SASLMechanism mechanism : REGISTERED_MECHANISMS) {
answer.put(mechanism.getClass().getName(), mechanism.toString());
@ -132,9 +132,9 @@ public final class SASLAuthentication {
return false;
}
public static boolean blacklistSASLMechanism(String mechansim) {
public static boolean blacklistSASLMechanism(String mechanism) {
synchronized (BLACKLISTED_MECHANISMS) {
return BLACKLISTED_MECHANISMS.add(mechansim);
return BLACKLISTED_MECHANISMS.add(mechanism);
}
}
@ -356,8 +356,8 @@ public final class SASLAuthentication {
throw new SmackException(
"No supported and enabled SASL Mechanism provided by server. " +
"Server announced mechanisms: " + serverMechanisms + ". " +
"Registerd SASL mechanisms with Smack: " + REGISTERED_MECHANISMS + ". " +
"Enabled SASL mechansisms for this connection: " + configuration.getEnabledSaslMechanisms() + ". " +
"Registered SASL mechanisms with Smack: " + REGISTERED_MECHANISMS + ". " +
"Enabled SASL mechanisms for this connection: " + configuration.getEnabledSaslMechanisms() + ". " +
"Blacklisted SASL mechanisms: " + BLACKLISTED_MECHANISMS + '.'
);
// @formatter;on

@ -55,11 +55,11 @@ public final class SmackConfiguration {
private static int defaultPacketReplyTimeout = 5000;
private static int packetCollectorSize = 5000;
private static List<String> defaultMechs = new ArrayList<String>();
private static List<String> defaultMechs = new ArrayList<>();
static Set<String> disabledSmackClasses = new HashSet<String>();
static Set<String> disabledSmackClasses = new HashSet<>();
final static List<XMPPInputOutputStream> compressionHandlers = new ArrayList<XMPPInputOutputStream>(2);
final static List<XMPPInputOutputStream> compressionHandlers = new ArrayList<>(2);
static boolean smackInitialized = false;
@ -67,7 +67,7 @@ public final class SmackConfiguration {
/**
* Value that indicates whether debugging is enabled. When enabled, a debug
* window will apear for each new connection that will contain the following
* window will appear for each new connection that will contain the following
* information:<ul>
* <li> Client Traffic -- raw XML traffic generated by Smack and sent to the server.
* <li> Server Traffic -- raw XML traffic sent by the server to the client.
@ -280,8 +280,8 @@ public final class SmackConfiguration {
compressionHandlers.add(xmppInputOutputStream);
}
public static List<XMPPInputOutputStream> getCompresionHandlers() {
List<XMPPInputOutputStream> res = new ArrayList<XMPPInputOutputStream>(compressionHandlers.size());
public static List<XMPPInputOutputStream> getCompressionHandlers() {
List<XMPPInputOutputStream> res = new ArrayList<>(compressionHandlers.size());
for (XMPPInputOutputStream ios : compressionHandlers) {
if (ios.isSupported()) {
res.add(ios);
@ -293,7 +293,7 @@ public final class SmackConfiguration {
/**
* Set the default HostnameVerifier that will be used by XMPP connections to verify the hostname
* of a TLS certificate. XMPP connections are able to overwrite this settings by supplying a
* HostnameVerifier in their ConnecitonConfiguration with
* HostnameVerifier in their ConnectionConfiguration with
* {@link ConnectionConfiguration.Builder#setHostnameVerifier(HostnameVerifier)}.
*/
public static void setDefaultHostnameVerifier(HostnameVerifier verifier) {

@ -258,7 +258,7 @@ public class SmackException extends Exception {
public ConnectionException(Throwable wrappedThrowable) {
super(wrappedThrowable);
failedAddresses = new ArrayList<HostAddress>(0);
failedAddresses = new ArrayList<>(0);
}
private ConnectionException(String message, List<HostAddress> failedAddresses) {

@ -40,7 +40,6 @@ import org.jivesoftware.smack.util.FileUtils;
import org.jivesoftware.smack.util.StringUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
@ -71,7 +70,7 @@ public final class SmackInitialization {
}
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Could not determine Smack version", e);
smackVersion = "unkown";
smackVersion = "unknown";
}
SMACK_VERSION = smackVersion;
@ -182,7 +181,7 @@ public final class SmackInitialization {
private static void parseClassesToLoad(XmlPullParser parser, boolean optional,
Collection<Exception> exceptions, ClassLoader classLoader)
throws XmlPullParserException, IOException, Exception {
throws Exception {
final String startName = parser.getName();
int eventType;
String name;

@ -288,7 +288,7 @@ public class StanzaCollector {
}
}
private final void throwIfCancelled() {
private void throwIfCancelled() {
if (cancelled) {
throw new IllegalStateException("Packet collector already cancelled");
}

@ -52,6 +52,6 @@ public interface StanzaListener {
* @throws InterruptedException
* @throws NotLoggedInException
*/
public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, NotLoggedInException;
void processStanza(Stanza packet) throws NotConnectedException, InterruptedException, NotLoggedInException;
}

@ -18,6 +18,6 @@ package org.jivesoftware.smack;
public interface SuccessCallback<T> {
public void onSuccess(T result);
void onSuccess(T result);
}

@ -27,7 +27,7 @@ public class XMPPConnectionRegistry {
* A set of listeners which will be invoked if a new connection is created.
*/
private final static Set<ConnectionCreationListener> connectionEstablishedListeners =
new CopyOnWriteArraySet<ConnectionCreationListener>();
new CopyOnWriteArraySet<>();
/**
* Adds a new listener that will be notified when new Connections are created. Note

@ -30,10 +30,7 @@ public final class EmptyToMatcher implements StanzaFilter {
@Override
public boolean accept(Stanza packet) {
Jid packetTo = packet.getTo();
if (packetTo == null) {
return true;
}
return false;
return packetTo == null;
}
@Override

@ -54,5 +54,5 @@ public interface StanzaFilter {
* @param stanza the stanza(/packet) to test.
* @return true if and only if <tt>stanza</tt> passes the filter.
*/
public boolean accept(Stanza stanza);
boolean accept(Stanza stanza);
}

@ -30,5 +30,5 @@ import org.jivesoftware.smack.SmackConfiguration;
*
*/
public interface SmackInitializer {
public List<Exception> initialize();
List<Exception> initialize();
}

@ -26,7 +26,7 @@ import org.jivesoftware.smack.packet.IQ;
*/
public interface IQRequestHandler {
public enum Mode {
enum Mode {
/**
* Process requests synchronously, i.e. in the order they arrive. Uses a single thread, which means that the other
* requests have to wait until all previous synchronous requests have been handled. Use {@link #async} if
@ -41,13 +41,13 @@ public interface IQRequestHandler {
async,
}
public IQ handleIQRequest(IQ iqRequest);
IQ handleIQRequest(IQ iqRequest);
public Mode getMode();
Mode getMode();
public IQ.Type getType();
IQ.Type getType();
public String getElement();
String getElement();
public String getNamespace();
String getNamespace();
}

@ -28,5 +28,5 @@ public interface Element {
*
* @return the stanza(/packet) extension as XML.
*/
public CharSequence toXML();
CharSequence toXML();
}

@ -25,7 +25,7 @@ public class EmptyResultIQ extends IQ {
public EmptyResultIQ(IQ request) {
this();
initialzeAsResultFor(request);
initializeAsResultFor(request);
}
@Override

@ -40,6 +40,6 @@ public interface ExtensionElement extends NamedElement {
*
* @return the namespace.
*/
public String getNamespace();
String getNamespace();
}

@ -215,7 +215,7 @@ public abstract class IQ extends Stanza {
*/
protected abstract IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml);
protected final void initialzeAsResultFor(IQ request) {
protected final void initializeAsResultFor(IQ request) {
if (!(request.getType() == Type.get || request.getType() == Type.set)) {
throw new IllegalArgumentException(
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());

@ -28,6 +28,6 @@ public interface NamedElement extends Element {
*
* @return the element name.
*/
public String getElementName();
String getElementName();
}

@ -28,15 +28,15 @@ import java.util.Set;
@Deprecated
public interface Packet extends TopLevelStreamElement {
public static final String TEXT = "text";
public static final String ITEM = "item";
String TEXT = "text";
String ITEM = "item";
/**
* Returns the unique ID of the stanza. The returned value could be <code>null</code>.
*
* @return the packet's unique ID or <code>null</code> if the id is not available.
*/
public String getStanzaId();
String getStanzaId();
/**
* Get the stanza id.
@ -44,7 +44,7 @@ public interface Packet extends TopLevelStreamElement {
* @deprecated use {@link #getStanzaId()} instead.
*/
@Deprecated
public String getPacketID();
String getPacketID();
/**
* Sets the unique ID of the packet. To indicate that a stanza(/packet) has no id
@ -52,7 +52,7 @@ public interface Packet extends TopLevelStreamElement {
*
* @param id the unique ID for the packet.
*/
public void setStanzaId(String id);
void setStanzaId(String id);
/**
* Set the stanza ID.
@ -60,7 +60,7 @@ public interface Packet extends TopLevelStreamElement {
* @deprecated use {@link #setStanzaId(String)} instead.
*/
@Deprecated
public void setPacketID(String packetID);
void setPacketID(String packetID);
/**
* Returns who the stanza(/packet) is being sent "to", or <tt>null</tt> if
@ -70,7 +70,7 @@ public interface Packet extends TopLevelStreamElement {
* @return who the stanza(/packet) is being sent to, or <tt>null</tt> if the
* value has not been set.
*/
public String getTo();
String getTo();
/**
* Sets who the stanza(/packet) is being sent "to". The XMPP protocol often makes
@ -78,7 +78,7 @@ public interface Packet extends TopLevelStreamElement {
*
* @param to who the stanza(/packet) is being sent to.
*/
public void setTo(String to);
void setTo(String to);
/**
* Returns who the stanza(/packet) is being sent "from" or <tt>null</tt> if
@ -88,7 +88,7 @@ public interface Packet extends TopLevelStreamElement {
* @return who the stanza(/packet) is being sent from, or <tt>null</tt> if the
* value has not been set.
*/
public String getFrom();
String getFrom();
/**
* Sets who the stanza(/packet) is being sent "from". The XMPP protocol often
@ -97,7 +97,7 @@ public interface Packet extends TopLevelStreamElement {
*
* @param from who the stanza(/packet) is being sent to.
*/
public void setFrom(String from);
void setFrom(String from);
/**
* Returns the error associated with this packet, or <tt>null</tt> if there are
@ -105,34 +105,34 @@ public interface Packet extends TopLevelStreamElement {
*
* @return the error sub-packet or <tt>null</tt> if there isn't an error.
*/
public XMPPError getError();
XMPPError getError();
/**
* Sets the error for this packet.
*
* @param error the error to associate with this packet.
*/
public void setError(XMPPError error);
void setError(XMPPError error);
/**
* Returns the xml:lang of this Stanza, or null if one has not been set.
*
* @return the xml:lang of this Stanza, or null.
*/
public String getLanguage();
String getLanguage();
/**
* Sets the xml:lang of this Stanza.
*
* @param language the xml:lang of this Stanza.
*/
public void setLanguage(String language);
void setLanguage(String language);
/**
* Returns a copy of the stanza(/packet) extensions attached to the packet.
*
* @return the stanza(/packet) extensions.
*/
public List<ExtensionElement> getExtensions();
List<ExtensionElement> getExtensions();
/**
* Return a set of all extensions with the given element name <emph>and</emph> namespace.
@ -145,7 +145,7 @@ public interface Packet extends TopLevelStreamElement {
* @return a set of all matching extensions.
* @since 4.1
*/
public Set<ExtensionElement> getExtensions(String elementName, String namespace);
Set<ExtensionElement> getExtensions(String elementName, String namespace);
/**
* Returns the first extension of this stanza(/packet) that has the given namespace.
@ -156,7 +156,7 @@ public interface Packet extends TopLevelStreamElement {
* @param namespace the namespace of the extension that is desired.
* @return the stanza(/packet) extension with the given namespace.
*/
public ExtensionElement getExtension(String namespace);
ExtensionElement getExtension(String namespace);
/**
* Returns the first stanza(/packet) extension that matches the specified element name and
@ -173,20 +173,20 @@ public interface Packet extends TopLevelStreamElement {
* @param namespace the XML element namespace of the stanza(/packet) extension.
* @return the extension, or <tt>null</tt> if it doesn't exist.
*/
public <PE extends ExtensionElement> PE getExtension(String elementName, String namespace);
<PE extends ExtensionElement> PE getExtension(String elementName, String namespace);
/**
* Adds a stanza(/packet) extension to the packet. Does nothing if extension is null.
*
* @param extension a stanza(/packet) extension.
*/
public void addExtension(ExtensionElement extension);
void addExtension(ExtensionElement extension);
/**
* Adds a collection of stanza(/packet) extensions to the packet. Does nothing if extensions is null.
*
* @param extensions a collection of stanza(/packet) extensions
*/
public void addExtensions(Collection<ExtensionElement> extensions);
void addExtensions(Collection<ExtensionElement> extensions);
/**
* Check if a stanza(/packet) extension with the given element and namespace exists.
@ -198,7 +198,7 @@ public interface Packet extends TopLevelStreamElement {
* @param namespace
* @return true if a stanza(/packet) extension exists, false otherwise.
*/
public boolean hasExtension(String elementName, String namespace);
boolean hasExtension(String elementName, String namespace);
/**
* Check if a stanza(/packet) extension with the given namespace exists.
@ -206,7 +206,7 @@ public interface Packet extends TopLevelStreamElement {
* @param namespace
* @return true if a stanza(/packet) extension exists, false otherwise.
*/
public boolean hasExtension(String namespace);
boolean hasExtension(String namespace);
/**
* Remove the stanza(/packet) extension with the given elementName and namespace.
@ -215,7 +215,7 @@ public interface Packet extends TopLevelStreamElement {
* @param namespace
* @return the removed stanza(/packet) extension or null.
*/
public ExtensionElement removeExtension(String elementName, String namespace);
ExtensionElement removeExtension(String elementName, String namespace);
/**
* Removes a stanza(/packet) extension from the packet.
@ -223,10 +223,10 @@ public interface Packet extends TopLevelStreamElement {
* @param extension the stanza(/packet) extension to remove.
* @return the removed stanza(/packet) extension or null.
*/
public ExtensionElement removeExtension(ExtensionElement extension);
ExtensionElement removeExtension(ExtensionElement extension);
@Override
// NOTE When Smack is using Java 8, then this method should be moved in Element as "Default Method".
public String toString();
String toString();
}

@ -25,7 +25,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
/**
* Represents a stream error packet. Stream errors are unrecoverable errors where the server
* will close the unrelying TCP connection after the stream error was sent to the client.
* will close the underlying TCP connection after the stream error was sent to the client.
* These is the list of stream errors as defined in the XMPP spec:<p>
*
* <table border=1>
@ -174,7 +174,7 @@ public class StreamError extends AbstractError implements Nonza {
restricted_xml,
see_other_host,
system_shutdown,
undeficed_condition,
undefined_condition,
unsupported_encoding,
unsupported_feature,
unsupported_stanza_type,

@ -39,6 +39,6 @@ public interface ParsingExceptionCallback {
* @param stanzaData the raw stanza data that caused the exception
* @throws Exception
*/
public void handleUnparsableStanza(UnparseableStanza stanzaData) throws Exception;
void handleUnparsableStanza(UnparseableStanza stanzaData) throws Exception;
}

@ -45,7 +45,7 @@ import org.jxmpp.util.XmppStringUtils;
* <li>jabber:iq:register</ul>
*
* Because many more IQ types are part of XMPP and its extensions, a pluggable IQ parsing
* mechanism is provided. IQ providers are registered programatically or by creating a
* mechanism is provided. IQ providers are registered programmatically or by creating a
* providers file. The file is an XML
* document that contains one or more iqProvider entries, as in the following example:
*
@ -100,7 +100,7 @@ import org.jxmpp.util.XmppStringUtils;
* is found in a packet, parsing will be passed to the correct provider. Each provider
* can either implement the PacketExtensionProvider interface or be a standard Java Bean. In
* the former case, each extension provider is responsible for parsing the raw XML stream to
* contruct an object. In the latter case, bean introspection is used to try to automatically
* construct an object. In the latter case, bean introspection is used to try to automatically
* set the properties of th class using the values in the stanza(/packet) extension sub-element. When an
* extension provider is not registered for an element name and namespace combination, Smack will
* store all top-level elements of the sub-packet in DefaultPacketExtension object and then
@ -207,7 +207,7 @@ public final class ProviderManager {
/**
* Removes an IQ provider with the specified element name and namespace. This
* method is typically called to cleanup providers that are programatically added
* method is typically called to cleanup providers that are programmatically added
* using the {@link #addIQProvider(String, String, Object) addIQProvider} method.
*
* @param elementName the XML element name.
@ -237,7 +237,7 @@ public final class ProviderManager {
*
* @param elementName element name associated with extension provider.
* @param namespace namespace associated with extension provider.
* @return the extenion provider.
* @return the extension provider.
*/
public static ExtensionElementProvider<ExtensionElement> getExtensionProvider(String elementName, String namespace) {
String key = getKey(elementName, namespace);
@ -269,7 +269,7 @@ public final class ProviderManager {
/**
* Removes an extension provider with the specified element name and namespace. This
* method is typically called to cleanup providers that are programatically added
* method is typically called to cleanup providers that are programmatically added
* using the {@link #addExtensionProvider(String, String, Object) addExtensionProvider} method.
*
* @param elementName the XML element name.

@ -78,7 +78,7 @@ class HTTPProxySocketConnection implements ProxySocketConnection {
got.append(c);
if (got.length() > 1024)
{
throw new ProxyException(ProxyInfo.ProxyType.HTTP, "Recieved " +
throw new ProxyException(ProxyInfo.ProxyType.HTTP, "Received " +
"header of >1024 characters from "
+ proxyhost + ", cancelling connection");
}

@ -25,7 +25,7 @@ package org.jivesoftware.smack.proxy;
public class ProxyInfo
{
public static enum ProxyType
public enum ProxyType
{
HTTP,
SOCKS4,

@ -21,7 +21,7 @@ import java.net.Socket;
public interface ProxySocketConnection {
public void connect(Socket socket, String host, int port, int timeout)
void connect(Socket socket, String host, int port, int timeout)
throws IOException;
}

@ -117,7 +117,7 @@ public class Socks4ProxySocketConnection implements ProxySocketConnection {
90: request granted
91: request rejected or failed
92: request rejected becasue SOCKS server cannot connect to
92: request rejected because SOCKS server cannot connect to
identd on the client
93: request rejected because the client program and identd
report different user-ids

@ -246,7 +246,7 @@ public abstract class ScramMechanism extends SASLMechanism {
return gs2Header;
}
return ByteUtils.concact(gs2Header, cbindData);
return ByteUtils.concat(gs2Header, cbindData);
}
protected String getChannelBindingName() {
@ -394,7 +394,7 @@ public abstract class ScramMechanism extends SASLMechanism {
throw new AssertionError();
}
// U1 := HMAC(str, salt + INT(1))
byte[] u = hmac(key, ByteUtils.concact(salt, ONE));
byte[] u = hmac(key, ByteUtils.concat(salt, ONE));
byte[] res = u.clone();
for (int i = 1; i < iterations; i++) {
u = hmac(key, u);

@ -73,7 +73,7 @@ public class Async {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
LOGGER.log(Level.WARNING, "Catched Exception", e);
LOGGER.log(Level.WARNING, "Caught Exception", e);
}
}

@ -17,7 +17,7 @@
package org.jivesoftware.smack.util;
public class ByteUtils {
public static byte[] concact(byte[] arrayOne, byte[] arrayTwo) {
public static byte[] concat(byte[] arrayOne, byte[] arrayTwo) {
int combinedLength = arrayOne.length + arrayTwo.length;
byte[] res = new byte[combinedLength];
System.arraycopy(arrayOne, 0, res, 0, arrayOne.length);

@ -35,7 +35,7 @@ public class LazyStringBuilder implements Appendable, CharSequence {
}
public LazyStringBuilder() {
list = new ArrayList<CharSequence>(20);
list = new ArrayList<>(20);
}
public LazyStringBuilder append(LazyStringBuilder lsb) {

@ -90,19 +90,17 @@ public class ObservableWriter extends Writer {
/**
* Notify that a new string has been written.
*
* @param str the written String to notify
*/
private void notifyListeners() {
WriterListener[] writerListeners = null;
WriterListener[] writerListeners;
synchronized (listeners) {
writerListeners = new WriterListener[listeners.size()];
listeners.toArray(writerListeners);
}
String str = stringBuilder.toString();
stringBuilder.setLength(0);
for (int i = 0; i < writerListeners.length; i++) {
writerListeners[i].write(str);
for (WriterListener writerListener : writerListeners) {
writerListener.write(str);
}
}

@ -229,7 +229,7 @@ public class PacketParserUtils {
String language = getLanguageAttribute(parser);
// determine message's default language
String defaultLanguage = null;
String defaultLanguage;
if (language != null && !"".equals(language.trim())) {
message.setLanguage(language);
defaultLanguage = language;
@ -746,7 +746,7 @@ public class PacketParserUtils {
public static Map<String, String> parseDescriptiveTexts(XmlPullParser parser, Map<String, String> descriptiveTexts)
throws XmlPullParserException, IOException {
if (descriptiveTexts == null) {
descriptiveTexts = new HashMap<String, String>();
descriptiveTexts = new HashMap<>();
}
String xmllang = getLanguageAttribute(parser);
if (xmllang == null) {
@ -805,7 +805,7 @@ public class PacketParserUtils {
*/
public static StreamError parseStreamError(XmlPullParser parser) throws Exception {
final int initialDepth = parser.getDepth();
List<ExtensionElement> extensions = new ArrayList<ExtensionElement>();
List<ExtensionElement> extensions = new ArrayList<>();
Map<String, String> descriptiveTexts = null;
StreamError.Condition condition = null;
String conditionText = null;
@ -857,7 +857,7 @@ public class PacketParserUtils {
throws Exception {
final int initialDepth = parser.getDepth();
Map<String, String> descriptiveTexts = null;
List<ExtensionElement> extensions = new ArrayList<ExtensionElement>();
List<ExtensionElement> extensions = new ArrayList<>();
XMPPError.Builder builder = XMPPError.getBuilder();
// Parse the error header

@ -32,7 +32,7 @@ public class PacketUtil {
* @deprecated use {@link #extensionElementFrom(Collection, String, String)} instead
*/
@Deprecated
public static <PE extends ExtensionElement> PE packetExtensionfromCollection(
public static <PE extends ExtensionElement> PE packetExtensionFromCollection(
Collection<ExtensionElement> collection, String element,
String namespace) {
return extensionElementFrom(collection, element, namespace);

@ -138,11 +138,7 @@ public class ParserUtils {
if (valueString == null)
return null;
valueString = valueString.toLowerCase(Locale.US);
if (valueString.equals("true") || valueString.equals("0")) {
return true;
} else {
return false;
}
return valueString.equals("true") || valueString.equals("0");
}
public static boolean getBooleanAttribute(XmlPullParser parser, String name,
@ -232,8 +228,7 @@ public class ParserUtils {
public static URI getUriFromNextText(XmlPullParser parser) throws XmlPullParserException, IOException, URISyntaxException {
String uriString = parser.nextText();
URI uri = new URI(uriString);
return uri;
return new URI(uriString);
}
public static String getRequiredAttribute(XmlPullParser parser, String name) throws IOException {
@ -253,7 +248,6 @@ public class ParserUtils {
}
public static String getXmlLang(XmlPullParser parser) {
String langString = parser.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang");
return langString;
return parser.getAttributeValue("http://www.w3.org/XML/1998/namespace", "lang");
}
}

@ -33,6 +33,6 @@ public interface ReaderListener {
*
* @param str the read String
*/
public abstract void read(String str);
void read(String str);
}

@ -18,6 +18,6 @@ package org.jivesoftware.smack.util;
public interface StringTransformer {
public String transform(String string);
String transform(String string);
}

@ -444,10 +444,10 @@ public class StringUtils {
}
public static boolean nullSafeCharSequenceEquals(CharSequence csOne, CharSequence csTwo) {
return nullSafeCharSequenceComperator(csOne, csTwo) == 0;
return nullSafeCharSequenceComparator(csOne, csTwo) == 0;
}
public static int nullSafeCharSequenceComperator(CharSequence csOne, CharSequence csTwo) {
public static int nullSafeCharSequenceComparator(CharSequence csOne, CharSequence csTwo) {
if (csOne == null ^ csTwo == null) {
return (csOne == null) ? -1 : 1;
}

@ -55,7 +55,7 @@ public class TLSUtils {
* According to the <a
* href="https://raw.githubusercontent.com/stpeter/manifesto/master/manifesto.txt">Encrypted
* XMPP Manifesto</a>, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and
* TLSv1.1. This method goes one step boyond and upgrades the handshake to use TLSv1 or better.
* TLSv1.1. This method goes one step beyond and upgrades the handshake to use TLSv1 or better.
* This method requires the underlying OS to support all of TLSv1.2 , 1.1 and 1.0.
* </p>
*

@ -29,6 +29,6 @@ public interface TypedCloneable<T> extends Cloneable {
*
* @return a cloned version of this instance.
*/
public T clone();
T clone();
}

@ -33,6 +33,6 @@ public interface WriterListener {
*
* @param str the written string
*/
public abstract void write(String str);
void write(String str);
}

@ -81,7 +81,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
/**
* Add a new element to this builder, with the {@link java.util.Date} instance as its content,
* which will get formated with {@link XmppDateTime#formatXEP0082Date(Date)}.
* which will get formatted with {@link XmppDateTime#formatXEP0082Date(Date)}.
*
* @param name element name
* @param content content of element
@ -123,7 +123,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {
/**
* Add a new element to this builder, with the {@link java.util.Date} instance as its content,
* which will get formated with {@link XmppDateTime#formatXEP0082Date(Date)}
* which will get formatted with {@link XmppDateTime#formatXEP0082Date(Date)}
* if {@link java.util.Date} instance is not <code>null</code>.
*
* @param name element name
@ -245,7 +245,7 @@ public class XmlStringBuilder implements Appendable, CharSequence {