Enable MissingJavadocPackage and UnnecessaryParentheses checkstyle checks

This commit is contained in:
Florian Schmaus 2019-07-24 09:18:39 +02:00
parent 2ac452fe1e
commit 4ca2c7cc69
76 changed files with 120 additions and 131 deletions

View File

@ -212,5 +212,9 @@
<property name="sortImportsInGroupAlphabetically" value="true"/> <property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/> <property name="separateLineBetweenGroups" value="true"/>
</module> </module>
<module name="MissingJavadocPackage"/>
<module name="UnnecessaryParentheses"/>
<module name="UnnecessarySemicolonInEnumeration"/>
<module name="UnnecessarySemicolonInTryWithResources"/>
</module> </module>
</module> </module>

View File

@ -65,11 +65,11 @@ public final class BOSHConfiguration extends ConnectionConfiguration {
} }
public String getProxyAddress() { public String getProxyAddress() {
return (proxy != null ? proxy.getProxyAddress() : null); return proxy != null ? proxy.getProxyAddress() : null;
} }
public int getProxyPort() { public int getProxyPort() {
return (proxy != null ? proxy.getProxyPort() : 8080); return proxy != null ? proxy.getProxyPort() : 8080;
} }
public boolean isUsingHTTPS() { public boolean isUsingHTTPS() {

View File

@ -755,7 +755,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
hostAddresses = DNSUtil.resolveXMPPServiceDomain(dnsName, failedAddresses, config.getDnssecMode()); hostAddresses = DNSUtil.resolveXMPPServiceDomain(dnsName, failedAddresses, config.getDnssecMode());
} }
// Either the populated host addresses are not empty *or* there must be at least one failed address. // Either the populated host addresses are not empty *or* there must be at least one failed address.
assert (!hostAddresses.isEmpty() || !failedAddresses.isEmpty()); assert !hostAddresses.isEmpty() || !failedAddresses.isEmpty();
return failedAddresses; return failedAddresses;
} }
@ -788,7 +788,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
@Override @Override
public final void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException { public final void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException {
Objects.requireNonNull(stanza, "Stanza must not be null"); Objects.requireNonNull(stanza, "Stanza must not be null");
assert (stanza instanceof Message || stanza instanceof Presence || stanza instanceof IQ); assert stanza instanceof Message || stanza instanceof Presence || stanza instanceof IQ;
throwNotConnectedExceptionIfAppropriate(); throwNotConnectedExceptionIfAppropriate();
switch (fromMode) { switch (fromMode) {
@ -1275,7 +1275,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
* @throws InterruptedException * @throws InterruptedException
*/ */
protected void processStanza(final Stanza stanza) throws InterruptedException { protected void processStanza(final Stanza stanza) throws InterruptedException {
assert (stanza != null); assert stanza != null;
final SmackDebugger debugger = this.debugger; final SmackDebugger debugger = this.debugger;
if (debugger != null) { if (debugger != null) {
@ -1892,7 +1892,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
@Override @Override
public final String toString() { public final String toString() {
EntityFullJid localEndpoint = getUser(); EntityFullJid localEndpoint = getUser();
String localEndpointString = (localEndpoint == null ? "not-authenticated" : localEndpoint.toString()); String localEndpointString = localEndpoint == null ? "not-authenticated" : localEndpoint.toString();
return getClass().getSimpleName() + '[' + localEndpointString + "] (" + getConnectionCounter() + ')'; return getClass().getSimpleName() + '[' + localEndpointString + "] (" + getConnectionCounter() + ')';
} }

View File

@ -209,7 +209,7 @@ public abstract class ConnectionConfiguration {
compressionEnabled = builder.compressionEnabled; compressionEnabled = builder.compressionEnabled;
// If the enabledSaslmechanisms are set, then they must not be empty // If the enabledSaslmechanisms are set, then they must not be empty
assert (enabledSaslMechanisms != null ? !enabledSaslMechanisms.isEmpty() : true); assert enabledSaslMechanisms == null || !enabledSaslMechanisms.isEmpty();
if (dnssecMode != DnssecMode.disabled && customSSLContext != null) { if (dnssecMode != DnssecMode.disabled && customSSLContext != null) {
throw new IllegalStateException("You can not use a custom SSL context with DNSSEC enabled"); throw new IllegalStateException("You can not use a custom SSL context with DNSSEC enabled");

View File

@ -447,6 +447,5 @@ public final class ReconnectionManager {
* Policy using fixed amount of time between reconnection attempts. * Policy using fixed amount of time between reconnection attempts.
*/ */
FIXED_DELAY, FIXED_DELAY,
;
} }
} }

View File

@ -88,7 +88,7 @@ public abstract class SmackFuture<V, E extends Exception> implements Future<V>,
} }
private V getOrThrowExecutionException() throws ExecutionException { private V getOrThrowExecutionException() throws ExecutionException {
assert (result != null || exception != null || cancelled); assert result != null || exception != null || cancelled;
if (result != null) { if (result != null) {
return result; return result;
} }
@ -96,7 +96,7 @@ public abstract class SmackFuture<V, E extends Exception> implements Future<V>,
throw new ExecutionException(exception); throw new ExecutionException(exception);
} }
assert (cancelled); assert cancelled;
throw new CancellationException(); throw new CancellationException();
} }

View File

@ -172,7 +172,7 @@ public class SmackReactor {
LOGGER.info(this + " shut down after " + shutDownDelay + "ms"); LOGGER.info(this + " shut down after " + shutDownDelay + "ms");
} else { } else {
boolean contained = reactorThreads.remove(this); boolean contained = reactorThreads.remove(this);
assert (contained); assert contained;
} }
} }
} }

View File

@ -79,7 +79,7 @@ public class SynchronizationPoint<E extends Exception> {
*/ */
public Exception sendAndWaitForResponse(TopLevelStreamElement request) throws NoResponseException, public Exception sendAndWaitForResponse(TopLevelStreamElement request) throws NoResponseException,
NotConnectedException, InterruptedException { NotConnectedException, InterruptedException {
assert (state == State.Initial); assert state == State.Initial;
connectionLock.lock(); connectionLock.lock();
try { try {
if (request != null) { if (request != null) {

View File

@ -56,7 +56,7 @@ public class Java7ZlibInputOutputStream extends XMPPInputOutputStream {
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
} }
method = m; method = m;
supported = (method != null); supported = method != null;
} }
public Java7ZlibInputOutputStream() { public Java7ZlibInputOutputStream() {

View File

@ -95,7 +95,7 @@ public final class ZlibXmppCompressionFactory extends XmppCompressionFactory {
} }
// There is an invariant of Deflater/Inflater that input should only be set if needsInput() return true. // There is an invariant of Deflater/Inflater that input should only be set if needsInput() return true.
assert (compressor.needsInput()); assert compressor.needsInput();
final byte[] compressorInputBuffer; final byte[] compressorInputBuffer;
final int compressorInputBufferOffset, compressorInputBufferLength; final int compressorInputBufferOffset, compressorInputBufferLength;

View File

@ -86,12 +86,12 @@ public abstract class SmackDebugger {
*/ */
public final Reader newConnectionReader(Reader reader) { public final Reader newConnectionReader(Reader reader) {
XmlPrettyPrinter xmlPrettyPrinter = XmlPrettyPrinter.builder() XmlPrettyPrinter xmlPrettyPrinter = XmlPrettyPrinter.builder()
.setPrettyWriter((sb) -> incomingStreamSink(sb)) .setPrettyWriter(sb -> incomingStreamSink(sb))
.build(); .build();
incomingStreamSplitterForPrettyPrinting = new XmppXmlSplitter(xmlPrettyPrinter); incomingStreamSplitterForPrettyPrinting = new XmppXmlSplitter(xmlPrettyPrinter);
ObservableReader observableReader = new ObservableReader(reader); ObservableReader observableReader = new ObservableReader(reader);
observableReader.addReaderListener((readString) -> { observableReader.addReaderListener(readString -> {
try { try {
incomingStreamSplitterForPrettyPrinting.append(readString); incomingStreamSplitterForPrettyPrinting.append(readString);
} }
@ -113,12 +113,12 @@ public abstract class SmackDebugger {
*/ */
public final Writer newConnectionWriter(Writer writer) { public final Writer newConnectionWriter(Writer writer) {
XmlPrettyPrinter xmlPrettyPrinter = XmlPrettyPrinter.builder() XmlPrettyPrinter xmlPrettyPrinter = XmlPrettyPrinter.builder()
.setPrettyWriter((sb) -> outgoingStreamSink(sb)) .setPrettyWriter(sb -> outgoingStreamSink(sb))
.build(); .build();
outgoingStreamSplitterForPrettyPrinting = new XmppXmlSplitter(xmlPrettyPrinter); outgoingStreamSplitterForPrettyPrinting = new XmppXmlSplitter(xmlPrettyPrinter);
ObservableWriter observableWriter = new ObservableWriter(writer); ObservableWriter observableWriter = new ObservableWriter(writer);
observableWriter.addWriterListener((writtenString) -> { observableWriter.addWriterListener(writtenString -> {
try { try {
outgoingStreamSplitterForPrettyPrinting.append(writtenString); outgoingStreamSplitterForPrettyPrinting.append(writtenString);
} }

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2017-2018 Florian Schmaus. * Copyright 2017-2019 Florian Schmaus.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,7 +28,6 @@ public abstract class AbstractJidTypeFilter implements StanzaFilter {
domainFull, domainFull,
domainBare, domainBare,
any, any,
;
} }
protected final JidType jidType; protected final JidType jidType;

View File

@ -178,7 +178,7 @@ public abstract class AbstractXmppStateMachineConnection extends AbstractXMPPCon
if (initialStateDescriptor.getClass() == walkStateGraphContext.finalStateClass) { if (initialStateDescriptor.getClass() == walkStateGraphContext.finalStateClass) {
// If this is used as final state, then it should be marked as such. // If this is used as final state, then it should be marked as such.
assert (initialStateDescriptor.isFinalState()); assert initialStateDescriptor.isFinalState();
// We reached the final state. // We reached the final state.
invokeConnectionStateMachineListener(new ConnectionStateEvent.FinalStateReached(initialState)); invokeConnectionStateMachineListener(new ConnectionStateEvent.FinalStateReached(initialState));
@ -578,7 +578,7 @@ public abstract class AbstractXmppStateMachineConnection extends AbstractXMPPCon
@Override @Override
protected TransitionIntoResult transitionInto(WalkStateGraphContext walkStateGraphContext) { protected TransitionIntoResult transitionInto(WalkStateGraphContext walkStateGraphContext) {
assert (walkFromDisconnectToAuthenticated == null); assert walkFromDisconnectToAuthenticated == null;
if (getStateDescriptor().getClass() == walkStateGraphContext.finalStateClass) { if (getStateDescriptor().getClass() == walkStateGraphContext.finalStateClass) {
// If this is the final state, then record the walk so far. // If this is the final state, then record the walk so far.
walkFromDisconnectToAuthenticated = new ArrayList<>(walkStateGraphContext.walkedStateGraphPath); walkFromDisconnectToAuthenticated = new ArrayList<>(walkStateGraphContext.walkedStateGraphPath);
@ -780,7 +780,7 @@ public abstract class AbstractXmppStateMachineConnection extends AbstractXMPPCon
if (walkFromDisconnectToAuthenticated != null) { if (walkFromDisconnectToAuthenticated != null) {
// If there was already a previous walk to ConnectedButUnauthenticated, then the context of the current // If there was already a previous walk to ConnectedButUnauthenticated, then the context of the current
// walk must not start from the 'Disconnected' state. // walk must not start from the 'Disconnected' state.
assert (walkStateGraphContext.walkedStateGraphPath.get(0).stateDescriptor.getClass() != DisconnectedStateDescriptor.class); assert walkStateGraphContext.walkedStateGraphPath.get(0).stateDescriptor.getClass() != DisconnectedStateDescriptor.class;
walkFromDisconnectToAuthenticated.addAll(walkStateGraphContext.walkedStateGraphPath); walkFromDisconnectToAuthenticated.addAll(walkStateGraphContext.walkedStateGraphPath);
} else { } else {
walkFromDisconnectToAuthenticated = new ArrayList<>(walkStateGraphContext.walkedStateGraphPath.size() + 1); walkFromDisconnectToAuthenticated = new ArrayList<>(walkStateGraphContext.walkedStateGraphPath.size() + 1);

View File

@ -326,7 +326,7 @@ public class StateDescriptorGraph {
private static <E> List<GraphVertex<E>> topologicalSort(Collection<GraphVertex<E>> vertexes) { private static <E> List<GraphVertex<E>> topologicalSort(Collection<GraphVertex<E>> vertexes) {
List<GraphVertex<E>> res = new ArrayList<>(); List<GraphVertex<E>> res = new ArrayList<>();
dfs(vertexes, (vertex) -> res.add(0, vertex), null); dfs(vertexes, vertex -> res.add(0, vertex), null);
return res; return res;
} }
@ -365,7 +365,7 @@ public class StateDescriptorGraph {
PrintWriter dotOut, boolean breakStateName) { PrintWriter dotOut, boolean breakStateName) {
dotOut.append("digraph {\n"); dotOut.append("digraph {\n");
dfs(vertexes, dfs(vertexes,
(finishedVertex) -> { finishedVertex -> {
boolean isMultiVisitState = finishedVertex.element.isMultiVisitState(); boolean isMultiVisitState = finishedVertex.element.isMultiVisitState();
boolean isFinalState = finishedVertex.element.isFinalState(); boolean isFinalState = finishedVertex.element.isFinalState();
boolean isNotImplemented = finishedVertex.element.isNotImplemented(); boolean isNotImplemented = finishedVertex.element.isNotImplemented();

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright © 2014 Florian Schmaus * Copyright © 2014-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -119,6 +119,6 @@ public class StreamOpen implements Nonza {
public enum StreamContentNamespace { public enum StreamContentNamespace {
client, client,
server; server,
} }
} }

View File

@ -152,7 +152,7 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
this.password = password; this.password = password;
this.authorizationId = authzid; this.authorizationId = authzid;
this.sslSession = sslSession; this.sslSession = sslSession;
assert (authorizationId == null || authzidSupported()); assert authorizationId == null || authzidSupported();
authenticateInternal(); authenticateInternal();
authenticate(); authenticate();
} }
@ -179,7 +179,7 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
this.serviceName = serviceName; this.serviceName = serviceName;
this.authorizationId = authzid; this.authorizationId = authzid;
this.sslSession = sslSession; this.sslSession = sslSession;
assert (authorizationId == null || authzidSupported()); assert authorizationId == null || authzidSupported();
authenticateInternal(cbh); authenticateInternal(cbh);
authenticate(); authenticate();
} }

View File

@ -228,7 +228,7 @@ public abstract class ScramMechanism extends SASLMechanism {
} }
String cbName = getChannelBindingName(); String cbName = getChannelBindingName();
assert (StringUtils.isNotEmpty(cbName)); assert StringUtils.isNotEmpty(cbName);
return cbName + ',' + authzidPortion + ","; return cbName + ',' + authzidPortion + ",";
} }

View File

@ -233,7 +233,7 @@ public class DNSUtil {
} }
for (SRVRecord r : bucket) { for (SRVRecord r : bucket) {
running_total += (r.getWeight() + zeroWeight); running_total += r.getWeight() + zeroWeight;
totals[count] = running_total; totals[count] = running_total;
count++; count++;
} }

View File

@ -148,7 +148,7 @@ public class MultiMap<K, V> {
if (res == null) { if (res == null) {
return null; return null;
} }
assert (!res.isEmpty()); assert !res.isEmpty();
return res.iterator().next(); return res.iterator().next();
} }

View File

@ -137,7 +137,7 @@ public class PacketParserUtils {
*/ */
public static Message parseMessage(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { public static Message parseMessage(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
ParserUtils.assertAtStartTag(parser); ParserUtils.assertAtStartTag(parser);
assert (parser.getName().equals(Message.ELEMENT)); assert parser.getName().equals(Message.ELEMENT);
XmlEnvironment messageXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment); XmlEnvironment messageXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
@ -218,7 +218,7 @@ public class PacketParserUtils {
* @throws IOException * @throws IOException
*/ */
public static String parseElementText(XmlPullParser parser) throws XmlPullParserException, IOException { public static String parseElementText(XmlPullParser parser) throws XmlPullParserException, IOException {
assert (parser.getEventType() == XmlPullParser.Event.START_ELEMENT); assert parser.getEventType() == XmlPullParser.Event.START_ELEMENT;
String res; String res;
// Advance to the text of the Element // Advance to the text of the Element
XmlPullParser.Event event = parser.next(); XmlPullParser.Event event = parser.next();
@ -263,7 +263,7 @@ public class PacketParserUtils {
public static CharSequence parseElement(XmlPullParser parser, public static CharSequence parseElement(XmlPullParser parser,
boolean fullNamespaces) throws XmlPullParserException, boolean fullNamespaces) throws XmlPullParserException,
IOException { IOException {
assert (parser.getEventType() == XmlPullParser.Event.START_ELEMENT); assert parser.getEventType() == XmlPullParser.Event.START_ELEMENT;
return parseContentDepth(parser, parser.getDepth(), fullNamespaces); return parseContentDepth(parser, parser.getDepth(), fullNamespaces);
} }
@ -631,7 +631,7 @@ public class PacketParserUtils {
*/ */
public static Compress.Feature parseCompressionFeature(XmlPullParser parser) public static Compress.Feature parseCompressionFeature(XmlPullParser parser)
throws IOException, XmlPullParserException { throws IOException, XmlPullParserException {
assert (parser.getEventType() == XmlPullParser.Event.START_ELEMENT); assert parser.getEventType() == XmlPullParser.Event.START_ELEMENT;
String name; String name;
final int initialDepth = parser.getDepth(); final int initialDepth = parser.getDepth();
List<String> methods = new LinkedList<>(); List<String> methods = new LinkedList<>();
@ -660,8 +660,8 @@ public class PacketParserUtils {
break; break;
} }
} }
assert (parser.getEventType() == XmlPullParser.Event.END_ELEMENT); assert parser.getEventType() == XmlPullParser.Event.END_ELEMENT;
assert (parser.getDepth() == initialDepth); assert parser.getDepth() == initialDepth;
return new Compress.Feature(methods); return new Compress.Feature(methods);
} }
@ -679,7 +679,7 @@ public class PacketParserUtils {
String text = parser.nextText(); String text = parser.nextText();
String previousValue = descriptiveTexts.put(xmllang, text); String previousValue = descriptiveTexts.put(xmllang, text);
assert (previousValue == null); assert previousValue == null;
return descriptiveTexts; return descriptiveTexts;
} }
@ -704,7 +704,7 @@ public class PacketParserUtils {
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts); descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
} }
else { else {
assert (condition == null); assert condition == null;
condition = parser.getName(); condition = parser.getName();
} }
break; break;
@ -875,8 +875,8 @@ public class PacketParserUtils {
public static StartTls parseStartTlsFeature(XmlPullParser parser) public static StartTls parseStartTlsFeature(XmlPullParser parser)
throws XmlPullParserException, IOException { throws XmlPullParserException, IOException {
assert (parser.getEventType() == XmlPullParser.Event.START_ELEMENT); ParserUtils.assertAtStartTag(parser);
assert (parser.getNamespace().equals(StartTls.NAMESPACE)); assert parser.getNamespace().equals(StartTls.NAMESPACE);
int initalDepth = parser.getDepth(); int initalDepth = parser.getDepth();
boolean required = false; boolean required = false;
outerloop: while (true) { outerloop: while (true) {
@ -900,7 +900,7 @@ public class PacketParserUtils {
break; break;
} }
} }
assert (parser.getEventType() == XmlPullParser.Event.END_ELEMENT); ParserUtils.assertAtEndTag(parser);
return new StartTls(required); return new StartTls(required);
} }

View File

@ -50,7 +50,7 @@ public class ParserUtils {
public static final String JID = "jid"; public static final String JID = "jid";
public static void assertAtStartTag(XmlPullParser parser) throws XmlPullParserException { public static void assertAtStartTag(XmlPullParser parser) throws XmlPullParserException {
assert (parser.getEventType() == XmlPullParser.Event.START_ELEMENT); assert parser.getEventType() == XmlPullParser.Event.START_ELEMENT;
} }
public static void assertAtStartTag(XmlPullParser parser, String name) throws XmlPullParserException { public static void assertAtStartTag(XmlPullParser parser, String name) throws XmlPullParserException {
@ -59,7 +59,7 @@ public class ParserUtils {
} }
public static void assertAtEndTag(XmlPullParser parser) throws XmlPullParserException { public static void assertAtEndTag(XmlPullParser parser) throws XmlPullParserException {
assert (parser.getEventType() == XmlPullParser.Event.END_ELEMENT); assert parser.getEventType() == XmlPullParser.Event.END_ELEMENT;
} }
public static void forwardToEndTagOfDepth(XmlPullParser parser, int depth) public static void forwardToEndTagOfDepth(XmlPullParser parser, int depth)

View File

@ -110,7 +110,6 @@ public class StringUtils {
forAttribute, forAttribute,
forAttributeApos, forAttributeApos,
forText, forText,
;
} }
/** /**

View File

@ -180,7 +180,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
} }
public XmlStringBuilder halfOpenElement(String name) { public XmlStringBuilder halfOpenElement(String name) {
assert (StringUtils.isNotEmpty(name)); assert StringUtils.isNotEmpty(name);
sb.append('<').append(name); sb.append('<').append(name);
return this; return this;
} }

View File

@ -111,7 +111,7 @@ public class HostAddress {
public void setException(InetAddress inetAddress, Exception exception) { public void setException(InetAddress inetAddress, Exception exception) {
Exception old = exceptions.put(inetAddress, exception); Exception old = exceptions.put(inetAddress, exception);
assert (old == null); assert old == null;
} }
/** /**

View File

@ -114,14 +114,14 @@ public class SmackTestUtil {
public static XmlPullParser getParserFor(String xml, QName startTagQName, XmlPullParserKind parserKind) public static XmlPullParser getParserFor(String xml, QName startTagQName, XmlPullParserKind parserKind)
throws XmlPullParserException, IOException { throws XmlPullParserException, IOException {
XmlPullParser parser = getParserFor(xml, parserKind); XmlPullParser parser = getParserFor(xml, parserKind);
forwardParserToStartElement(parser, (p) -> p.getQName().equals(startTagQName)); forwardParserToStartElement(parser, p -> p.getQName().equals(startTagQName));
return parser; return parser;
} }
public static XmlPullParser getParserFor(String xml, String startTagLocalpart, XmlPullParserKind parserKind) public static XmlPullParser getParserFor(String xml, String startTagLocalpart, XmlPullParserKind parserKind)
throws XmlPullParserException, IOException { throws XmlPullParserException, IOException {
XmlPullParser parser = getParserFor(xml, parserKind); XmlPullParser parser = getParserFor(xml, parserKind);
forwardParserToStartElement(parser, (p) -> p.getName().equals(startTagLocalpart)); forwardParserToStartElement(parser, p -> p.getName().equals(startTagLocalpart));
return parser; return parser;
} }

View File

@ -138,7 +138,7 @@ public final class CarbonManager extends Manager {
// also reset here. // also reset here.
enabled_state = false; enabled_state = false;
boolean removed = connection().removeSyncStanzaListener(carbonsListener); boolean removed = connection().removeSyncStanzaListener(carbonsListener);
assert (removed); assert removed;
} }
@Override @Override
public void authenticated(XMPPConnection connection, boolean resumed) { public void authenticated(XMPPConnection connection, boolean resumed) {

View File

@ -62,7 +62,7 @@ public final class EligibleForChatMarkerFilter extends StanzaExtensionFilter {
ChatState state; ChatState state;
try { try {
state = ChatState.valueOf(chatStateElementName); state = ChatState.valueOf(chatStateElementName);
return (state == ChatState.active); return state == ChatState.active;
} }
catch (Exception ex) { catch (Exception ex) {
return false; return false;

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2017 Florian Schmaus * Copyright 2017-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,6 +22,5 @@ public enum MessageProcessingHintType {
no_store, no_store,
no_copy, no_copy,
store, store,
;
} }

View File

@ -134,7 +134,7 @@ public final class HttpFileUploadManager extends Manager {
} }
private static UploadService uploadServiceFrom(DiscoverInfo discoverInfo) { private static UploadService uploadServiceFrom(DiscoverInfo discoverInfo) {
assert (containsHttpFileUploadNamespace(discoverInfo)); assert containsHttpFileUploadNamespace(discoverInfo);
UploadService.Version version; UploadService.Version version;
if (discoverInfo.containsFeature(NAMESPACE)) { if (discoverInfo.containsFeature(NAMESPACE)) {

View File

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2016 Florian Schmaus * Copyright 2016-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -316,7 +316,7 @@ public final class IoTProvisioningManager extends Manager {
return null; return null;
} }
Jid jid = discoverInfos.get(0).getFrom(); Jid jid = discoverInfos.get(0).getFrom();
assert (jid.isDomainBareJid()); assert jid.isDomainBareJid();
return jid.asDomainBareJid(); return jid.asDomainBareJid();
} }
@ -341,7 +341,7 @@ public final class IoTProvisioningManager extends Manager {
IoTIsFriend iotIsFriend = new IoTIsFriend(friendInQuestion); IoTIsFriend iotIsFriend = new IoTIsFriend(friendInQuestion);
iotIsFriend.setTo(provisioningServer); iotIsFriend.setTo(provisioningServer);
IoTIsFriendResponse response = connection().createStanzaCollectorAndSend(iotIsFriend).nextResultOrThrow(); IoTIsFriendResponse response = connection().createStanzaCollectorAndSend(iotIsFriend).nextResultOrThrow();
assert (response.getJid().equals(friendInQuestion)); assert response.getJid().equals(friendInQuestion);
boolean isFriend = response.getIsFriendResult(); boolean isFriend = response.getIsFriendResult();
if (!isFriend) { if (!isFriend) {
// Cache the negative is friend response. // Cache the negative is friend response.

View File

@ -39,7 +39,6 @@ public class MamPrefsIQ extends IQ {
always, always,
never, never,
roster, roster,
;
} }
/** /**

View File

@ -48,7 +48,7 @@ public class MamResultFilter extends FlexibleStanzaTypeFilter<Message> {
} }
String resultQueryId = mamResultExtension.getQueryId(); String resultQueryId = mamResultExtension.getQueryId();
return ((queryId == null && resultQueryId == null) || (queryId != null && queryId.equals(resultQueryId))); return (queryId == null && resultQueryId == null) || (queryId != null && queryId.equals(resultQueryId));
} }
} }

View File

@ -65,7 +65,7 @@ public class AbstractHttpOverXmppProviderTest {
IQ iq = provider.parse(parser); IQ iq = provider.parse(parser);
assertTrue(iq instanceof HttpOverXmppResp); assertTrue(iq instanceof HttpOverXmppResp);
HttpOverXmppResp body = ((HttpOverXmppResp) iq); HttpOverXmppResp body = (HttpOverXmppResp) iq;
checkHeaders(body.getHeaders(), expectedHeaders); checkHeaders(body.getHeaders(), expectedHeaders);
} }
@ -85,7 +85,7 @@ public class AbstractHttpOverXmppProviderTest {
IQ iq = provider.parse(parser); IQ iq = provider.parse(parser);
assertTrue(iq instanceof HttpOverXmppReq); assertTrue(iq instanceof HttpOverXmppReq);
HttpOverXmppReq body = ((HttpOverXmppReq) iq); HttpOverXmppReq body = (HttpOverXmppReq) iq;
checkHeaders(body.getHeaders(), expectedHeaders); checkHeaders(body.getHeaders(), expectedHeaders);
} }

View File

@ -79,7 +79,7 @@ public class ServiceAdministrationManager extends Manager {
answerForm.setAnswer("password-verify", password); answerForm.setAnswer("password-verify", password);
command.execute(answerForm); command.execute(answerForm);
assert (command.isCompleted()); assert command.isCompleted();
} }
public RemoteCommand deleteUser() { public RemoteCommand deleteUser() {
@ -106,6 +106,6 @@ public class ServiceAdministrationManager extends Manager {
answerForm.setAnswer("accountjids", jidsToDelete); answerForm.setAnswer("accountjids", jidsToDelete);
command.execute(answerForm); command.execute(answerForm);
assert (command.isCompleted()); assert command.isCompleted();
} }
} }

View File

@ -82,7 +82,7 @@ public class BoBData {
private void setContentBinaryIfRequired() { private void setContentBinaryIfRequired() {
if (contentBinary == null) { if (contentBinary == null) {
assert (StringUtils.isNotEmpty(contentString)); assert StringUtils.isNotEmpty(contentString);
contentBinary = Base64.decode(contentString); contentBinary = Base64.decode(contentString);
} }
} }

View File

@ -757,7 +757,7 @@ public class InBandBytestreamSession implements BytestreamSession {
bufferPointer = 0; bufferPointer = 0;
// increment sequence, considering sequence overflow // increment sequence, considering sequence overflow
this.seq = (this.seq + 1 == 65535 ? 0 : this.seq + 1); this.seq = this.seq + 1 == 65535 ? 0 : this.seq + 1;
} }

View File

@ -33,7 +33,7 @@ public abstract class AbstractDelayInformationProvider extends ExtensionElementP
public final DelayInformation parse(XmlPullParser parser, public final DelayInformation parse(XmlPullParser parser,
int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException,
IOException, SmackTextParseException { IOException, SmackTextParseException {
String stampString = (parser.getAttributeValue("", "stamp")); String stampString = parser.getAttributeValue("", "stamp");
String from = parser.getAttributeValue("", "from"); String from = parser.getAttributeValue("", "from");
final String reason; final String reason;
XmlPullParser.Event event = parser.next(); XmlPullParser.Event event = parser.next();

View File

@ -79,7 +79,7 @@ public class DiscoverInfoProvider extends IQProvider<DiscoverInfo> {
if (parser.getName().equals("feature")) { if (parser.getName().equals("feature")) {
// Create a new feature and add it to the discovered info. // Create a new feature and add it to the discovered info.
boolean notADuplicateFeature = discoverInfo.addFeature(variable); boolean notADuplicateFeature = discoverInfo.addFeature(variable);
assert (notADuplicateFeature); assert notADuplicateFeature;
} }
if (parser.getName().equals("query")) { if (parser.getName().equals("query")) {
done = true; done = true;

View File

@ -73,7 +73,7 @@ public final class FileTransferNegotiator extends Manager {
* set this variable to true for testing purposes as IBB is the backup file transfer method * set this variable to true for testing purposes as IBB is the backup file transfer method
* and shouldn't be used as the only transfer method in production systems. * and shouldn't be used as the only transfer method in production systems.
*/ */
public static boolean IBB_ONLY = (System.getProperty("ibb") != null);//true; public static boolean IBB_ONLY = System.getProperty("ibb") != null;//true;
/** /**
* Returns the file transfer negotiator related to a particular connection. * Returns the file transfer negotiator related to a particular connection.

View File

@ -214,7 +214,7 @@ public final class LastActivityManager extends Manager {
private long getIdleTime() { private long getIdleTime() {
long lms = lastMessageSent; long lms = lastMessageSent;
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
return ((now - lms) / 1000); return (now - lms) / 1000;
} }
/** /**

View File

@ -19,5 +19,4 @@ package org.jivesoftware.smackx.jingle;
public enum Role { public enum Role {
initiator, initiator,
responder, responder,
;
} }

View File

@ -208,7 +208,7 @@ public class RoomInfo {
FormField subjectmodField = form.getField("muc#roominfo_subjectmod"); FormField subjectmodField = form.getField("muc#roominfo_subjectmod");
if (subjectmodField != null && !subjectmodField.getValues().isEmpty()) { if (subjectmodField != null && !subjectmodField.getValues().isEmpty()) {
String firstValue = subjectmodField.getFirstValue(); String firstValue = subjectmodField.getFirstValue();
subjectmod = ("true".equals(firstValue) || "1".equals(firstValue)); subjectmod = "true".equals(firstValue) || "1".equals(firstValue);
} }
FormField urlField = form.getField("muc#roominfo_logs"); FormField urlField = form.getField("muc#roominfo_logs");

View File

@ -104,9 +104,9 @@ public final class PepManager extends Manager {
public void processStanza(Stanza stanza) { public void processStanza(Stanza stanza) {
final Message message = (Message) stanza; final Message message = (Message) stanza;
final EventElement event = EventElement.from(stanza); final EventElement event = EventElement.from(stanza);
assert (event != null); assert event != null;
final EntityBareJid from = message.getFrom().asEntityBareJidIfPossible(); final EntityBareJid from = message.getFrom().asEntityBareJidIfPossible();
assert (from != null); assert from != null;
asyncButOrdered.performAsyncButOrdered(from, new Runnable() { asyncButOrdered.performAsyncButOrdered(from, new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -37,5 +37,5 @@ public enum AccessModel {
roster, roster,
/** Only those on a whitelist may subscribe and retrieve items. */ /** Only those on a whitelist may subscribe and retrieve items. */
whitelist; whitelist,
} }

View File

@ -167,7 +167,7 @@ public class Affiliation implements ExtensionElement {
*/ */
public boolean isAffiliationModification() { public boolean isAffiliationModification() {
if (jid != null && affiliation != null) { if (jid != null && affiliation != null) {
assert (node == null && namespace == AffiliationNamespace.owner); assert node == null && namespace == AffiliationNamespace.owner;
return true; return true;
} }
return false; return false;

View File

@ -30,5 +30,5 @@ public enum ChildrenAssociationPolicy {
owners, owners,
/** Only those on a whitelist may associate leaf nodes with the collection. */ /** Only those on a whitelist may associate leaf nodes with the collection. */
whitelist; whitelist,
} }

View File

@ -50,6 +50,6 @@ public class ConfigurationEvent extends NodeExtension implements EmbeddedPacketE
if (getConfiguration() == null) if (getConfiguration() == null)
return Collections.emptyList(); return Collections.emptyList();
else else
return Arrays.asList(((ExtensionElement) getConfiguration().getDataFormToSend())); return Arrays.asList((ExtensionElement) getConfiguration().getDataFormToSend());
} }
} }

View File

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.pubsub;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.xdata.Form; import org.jivesoftware.smackx.xdata.Form;
import org.jivesoftware.smackx.xdata.FormField; import org.jivesoftware.smackx.xdata.FormField;
import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.smackx.xdata.packet.DataForm;
@ -246,7 +247,7 @@ public class ConfigureForm extends Form {
* @return true if it does, false otherwise * @return true if it does, false otherwise
*/ */
public boolean isDeliverPayloads() { public boolean isDeliverPayloads() {
return parseBoolean(getFieldValue(ConfigureNodeFields.deliver_payloads)); return ParserUtils.parseXmlBoolean(getFieldValue(ConfigureNodeFields.deliver_payloads));
} }
/** /**
@ -353,7 +354,7 @@ public class ConfigureForm extends Form {
* @return true if they should be notified, false otherwise * @return true if they should be notified, false otherwise
*/ */
public boolean isNotifyConfig() { public boolean isNotifyConfig() {
return parseBoolean(getFieldValue(ConfigureNodeFields.notify_config)); return ParserUtils.parseXmlBoolean(getFieldValue(ConfigureNodeFields.notify_config));
} }
/** /**
@ -372,7 +373,7 @@ public class ConfigureForm extends Form {
* @return true if subscribers should be notified, false otherwise * @return true if subscribers should be notified, false otherwise
*/ */
public boolean isNotifyDelete() { public boolean isNotifyDelete() {
return parseBoolean(getFieldValue(ConfigureNodeFields.notify_delete)); return ParserUtils.parseXmlBoolean(getFieldValue(ConfigureNodeFields.notify_delete));
} }
/** /**
@ -392,7 +393,7 @@ public class ConfigureForm extends Form {
* @return true if subscribers should be notified, false otherwise * @return true if subscribers should be notified, false otherwise
*/ */
public boolean isNotifyRetract() { public boolean isNotifyRetract() {
return parseBoolean(getFieldValue(ConfigureNodeFields.notify_retract)); return ParserUtils.parseXmlBoolean(getFieldValue(ConfigureNodeFields.notify_retract));
} }
/** /**
@ -436,7 +437,7 @@ public class ConfigureForm extends Form {
* @return true if items are persisted * @return true if items are persisted
*/ */
public boolean isPersistItems() { public boolean isPersistItems() {
return parseBoolean(getFieldValue(ConfigureNodeFields.persist_items)); return ParserUtils.parseXmlBoolean(getFieldValue(ConfigureNodeFields.persist_items));
} }
/** /**
@ -455,7 +456,7 @@ public class ConfigureForm extends Form {
* @return true if users must be available * @return true if users must be available
*/ */
public boolean isPresenceBasedDelivery() { public boolean isPresenceBasedDelivery() {
return parseBoolean(getFieldValue(ConfigureNodeFields.presence_based_delivery)); return ParserUtils.parseXmlBoolean(getFieldValue(ConfigureNodeFields.presence_based_delivery));
} }
/** /**
@ -566,7 +567,7 @@ public class ConfigureForm extends Form {
* @return true if subscriptions are allowed, false otherwise * @return true if subscriptions are allowed, false otherwise
*/ */
public boolean isSubscribe() { public boolean isSubscribe() {
return parseBoolean(getFieldValue(ConfigureNodeFields.subscribe)); return ParserUtils.parseXmlBoolean(getFieldValue(ConfigureNodeFields.subscribe));
} }
/** /**
@ -645,10 +646,6 @@ public class ConfigureForm extends Form {
return result.toString(); return result.toString();
} }
private static boolean parseBoolean(String fieldValue) {
return ("1".equals(fieldValue) || "true".equals(fieldValue));
}
private String getFieldValue(ConfigureNodeFields field) { private String getFieldValue(ConfigureNodeFields field) {
FormField formField = getField(field.getFieldName()); FormField formField = getField(field.getFieldName());

View File

@ -96,7 +96,7 @@ public class ItemPublishEvent<T extends Item> extends SubscriptionEvent {
* @return true if the items are delayed, false otherwise. * @return true if the items are delayed, false otherwise.
*/ */
public boolean isDelayed() { public boolean isDelayed() {
return (originalDate != null); return originalDate != null;
} }
/** /**

View File

@ -305,7 +305,7 @@ public class LeafNode extends Node {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T extends Item> void publish(T item) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { public <T extends Item> void publish(T item) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Collection<T> items = new ArrayList<>(1); Collection<T> items = new ArrayList<>(1);
items.add((item == null ? (T) new Item() : item)); items.add(item == null ? (T) new Item() : item);
publish(items); publish(items);
} }

View File

@ -70,7 +70,7 @@ public enum PubSubElementType {
public static PubSubElementType valueOfFromElemName(String elemName, String namespace) { public static PubSubElementType valueOfFromElemName(String elemName, String namespace) {
int index = namespace.lastIndexOf('#'); int index = namespace.lastIndexOf('#');
String fragment = (index == -1 ? null : namespace.substring(index + 1)); String fragment = index == -1 ? null : namespace.substring(index + 1);
if (fragment != null) { if (fragment != null) {
return valueOf((elemName + '_' + fragment).toUpperCase(Locale.US)); return valueOf((elemName + '_' + fragment).toUpperCase(Locale.US));

View File

@ -23,6 +23,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UnknownFormatConversionException; import java.util.UnknownFormatConversionException;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.xdata.Form; import org.jivesoftware.smackx.xdata.Form;
import org.jivesoftware.smackx.xdata.FormField; import org.jivesoftware.smackx.xdata.FormField;
import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.smackx.xdata.packet.DataForm;
@ -58,7 +59,7 @@ public class SubscribeForm extends Form {
* @return true if want to receive, false otherwise * @return true if want to receive, false otherwise
*/ */
public boolean isDeliverOn() { public boolean isDeliverOn() {
return parseBoolean(getFieldValue(SubscribeOptionFields.deliver)); return ParserUtils.parseXmlBoolean(getFieldValue(SubscribeOptionFields.deliver));
} }
/** /**
@ -77,7 +78,7 @@ public class SubscribeForm extends Form {
* @return true to aggregate, false otherwise * @return true to aggregate, false otherwise
*/ */
public boolean isDigestOn() { public boolean isDigestOn() {
return parseBoolean(getFieldValue(SubscribeOptionFields.digest)); return ParserUtils.parseXmlBoolean(getFieldValue(SubscribeOptionFields.digest));
} }
/** /**
@ -143,7 +144,7 @@ public class SubscribeForm extends Form {
* @return true to receive the message body, false otherwise * @return true to receive the message body, false otherwise
*/ */
public boolean isIncludeBody() { public boolean isIncludeBody() {
return parseBoolean(getFieldValue(SubscribeOptionFields.include_body)); return ParserUtils.parseXmlBoolean(getFieldValue(SubscribeOptionFields.include_body));
} }
/** /**
@ -188,11 +189,6 @@ public class SubscribeForm extends Form {
setAnswer(SubscribeOptionFields.show_values.getFieldName(), values); setAnswer(SubscribeOptionFields.show_values.getFieldName(), values);
} }
private static boolean parseBoolean(String fieldValue) {
return ("1".equals(fieldValue) || "true".equals(fieldValue));
}
private String getFieldValue(SubscribeOptionFields field) { private String getFieldValue(SubscribeOptionFields field) {
FormField formField = getField(field.getFieldName()); FormField formField = getField(field.getFieldName());

View File

@ -55,7 +55,7 @@ public class SubscriptionProvider extends ExtensionElementProvider<Subscription>
while (tag != XmlPullParser.Event.END_ELEMENT && !parser.getName().equals("subscribe-options")) tag = parser.next(); while (tag != XmlPullParser.Event.END_ELEMENT && !parser.getName().equals("subscribe-options")) tag = parser.next();
} }
while (parser.getEventType() != XmlPullParser.Event.END_ELEMENT) parser.next(); while (parser.getEventType() != XmlPullParser.Event.END_ELEMENT) parser.next();
return new Subscription(jid, nodeId, subId, (state == null ? null : Subscription.State.valueOf(state)), isRequired); return new Subscription(jid, nodeId, subId, state == null ? null : Subscription.State.valueOf(state), isRequired);
} }
} }

View File

@ -309,7 +309,7 @@ public final class DeliveryReceiptManager extends Manager {
* @return true if a delivery receipt was requested * @return true if a delivery receipt was requested
*/ */
public static boolean hasDeliveryReceiptRequest(Message message) { public static boolean hasDeliveryReceiptRequest(Message message) {
return (DeliveryReceiptRequest.from(message) != null); return DeliveryReceiptRequest.from(message) != null;
} }
/** /**

View File

@ -26,7 +26,7 @@ public class MucMemoryLeakTest extends SmackTestSuite {
@Test @Test
public void mucMemoryLeakTest() throws XmppStringprepException, IllegalArgumentException, InterruptedException { public void mucMemoryLeakTest() throws XmppStringprepException, IllegalArgumentException, InterruptedException {
MemoryLeakTestUtil.noResourceLeakTest((c) -> MultiUserChatManager.getInstanceFor(c)); MemoryLeakTestUtil.noResourceLeakTest(c -> MultiUserChatManager.getInstanceFor(c));
} }
} }

View File

@ -103,7 +103,7 @@ public final class ChatManager extends Manager{
* Will attempt to match on the JID in the from field, and then attempt the base JID if no match was found. * Will attempt to match on the JID in the from field, and then attempt the base JID if no match was found.
* This is the most lenient matching. * This is the most lenient matching.
*/ */
BARE_JID; BARE_JID,
} }
private final StanzaFilter packetFilter = new OrFilter(MessageTypeFilter.CHAT, new FlexibleStanzaTypeFilter<Message>() { private final StanzaFilter packetFilter = new OrFilter(MessageTypeFilter.CHAT, new FlexibleStanzaTypeFilter<Message>() {

View File

@ -1570,7 +1570,7 @@ public final class Roster extends Manager {
else { else {
fullFrom = from.asFullJidIfPossible(); fullFrom = from.asFullJidIfPossible();
// We know that this must be a full JID in this case. // We know that this must be a full JID in this case.
assert (fullFrom != null); assert fullFrom != null;
} }
} }
Map<Resourcepart, Presence> userPresences; Map<Resourcepart, Presence> userPresences;

View File

@ -123,7 +123,7 @@ public final class RosterEntry extends Manager {
* @param item new item * @param item new item
*/ */
void updateItem(RosterPacket.Item item) { void updateItem(RosterPacket.Item item) {
assert (item != null); assert item != null;
this.item = item; this.item = item;
} }

View File

@ -113,7 +113,7 @@ public class RosterPacketProvider extends IQProvider<RosterPacket> {
} }
} }
ParserUtils.assertAtEndTag(parser); ParserUtils.assertAtEndTag(parser);
assert (item != null); assert item != null;
return item; return item;
} }
} }

View File

@ -149,7 +149,7 @@ public final class Configuration {
this.disabledTests = disabledTests; this.disabledTests = disabledTests;
this.testPackages = testPackages; this.testPackages = testPackages;
this.configurationApplier = (builder) -> { this.configurationApplier = builder -> {
if (tlsContext != null) { if (tlsContext != null) {
builder.setCustomSSLContext(tlsContext); builder.setCustomSSLContext(tlsContext);
} }

View File

@ -592,7 +592,7 @@ public class SmackIntegrationTestFramework<DC extends AbstractXMPPConnection> {
} }
final String className = clz.getName(); final String className = clz.getName();
final String unqualifiedClassName = clz.getSimpleName(); final String unqualifiedClassName = clz.getSimpleName();
return (classes.contains(className) || classes.contains(unqualifiedClassName)); return classes.contains(className) || classes.contains(unqualifiedClassName);
} }
public static final class TestRunResult { public static final class TestRunResult {
@ -709,7 +709,7 @@ public class SmackIntegrationTestFramework<DC extends AbstractXMPPConnection> {
this.testMethod = testMethod; this.testMethod = testMethod;
smackIntegrationTestAnnotation = testMethod.getAnnotation(SmackIntegrationTest.class); smackIntegrationTestAnnotation = testMethod.getAnnotation(SmackIntegrationTest.class);
assert (smackIntegrationTestAnnotation != null); assert smackIntegrationTestAnnotation != null;
parameterListOfConnections = testMethodParametersIsListOfConnections(testMethod); parameterListOfConnections = testMethodParametersIsListOfConnections(testMethod);
} }

View File

@ -28,7 +28,7 @@ public abstract class TestResult {
public TestResult(SmackIntegrationTestFramework.ConcreteTest concreteTest, long startTime, long endTime, List<String> logMessages) { public TestResult(SmackIntegrationTestFramework.ConcreteTest concreteTest, long startTime, long endTime, List<String> logMessages) {
this.concreteTest = concreteTest; this.concreteTest = concreteTest;
assert (endTime >= startTime); assert endTime >= startTime;
this.startTime = startTime; this.startTime = startTime;
this.endTime = endTime; this.endTime = endTime;
this.duration = endTime - startTime; this.duration = endTime - startTime;

View File

@ -283,7 +283,7 @@ public class XmppConnectionManager<DC extends AbstractXMPPConnection> {
registerAccount(finalAccountUsername, finalAccountPassword); registerAccount(finalAccountUsername, finalAccountPassword);
} }
DC mainConnection = defaultConnectionDescriptor.construct(sinttestConfiguration, (builder) -> { DC mainConnection = defaultConnectionDescriptor.construct(sinttestConfiguration, builder -> {
try { try {
builder.setUsernameAndPassword(finalAccountUsername, finalAccountPassword) builder.setUsernameAndPassword(finalAccountUsername, finalAccountPassword)
.setResource(middlefix + '-' + testRunId); .setResource(middlefix + '-' + testRunId);
@ -398,7 +398,7 @@ public class XmppConnectionManager<DC extends AbstractXMPPConnection> {
throw new IllegalArgumentException(e); throw new IllegalArgumentException(e);
} }
ConnectionConfigurationBuilderApplier usernameAndPasswordApplier = (configurationBuilder) -> { ConnectionConfigurationBuilderApplier usernameAndPasswordApplier = configurationBuilder -> {
configurationBuilder.setUsernameAndPassword(username, password); configurationBuilder.setUsernameAndPassword(username, password);
}; };

View File

@ -354,7 +354,7 @@ public class MediaNegotiator extends JingleNegotiator {
* @return true if the content is fully negotiated. * @return true if the content is fully negotiated.
*/ */
public boolean isFullyEstablished() { public boolean isFullyEstablished() {
return (isEstablished() && ((getNegotiatorState() == JingleNegotiatorState.SUCCEEDED) || (getNegotiatorState() == JingleNegotiatorState.FAILED))); return isEstablished() && ((getNegotiatorState() == JingleNegotiatorState.SUCCEEDED) || (getNegotiatorState() == JingleNegotiatorState.FAILED));
} }
// Payload types // Payload types

View File

@ -164,7 +164,7 @@ public class ImageTransmitter implements Runnable {
} }
} }
trace = (System.currentTimeMillis() - trace); trace = System.currentTimeMillis() - trace;
LOGGER.fine("Loop Time:" + trace); LOGGER.fine("Loop Time:" + trace);
if (trace < 500) { if (trace < 500) {

View File

@ -648,7 +648,7 @@ public abstract class TransportCandidate {
this.id = session.getSid(); this.id = session.getSid();
this.candidate = candidate; this.candidate = candidate;
int keySplitIndex = ((int) Math.ceil(((float) id.length()) / 2)); int keySplitIndex = (int) Math.ceil(((float) id.length()) / 2);
String local = id.substring(0, keySplitIndex) + ";" + localUser; String local = id.substring(0, keySplitIndex) + ";" + localUser;
String remote = id.substring(keySplitIndex) + ";" + remoteUser; String remote = id.substring(keySplitIndex) + ";" + remoteUser;

View File

@ -281,7 +281,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
* @return true if the transport is fully established. * @return true if the transport is fully established.
*/ */
public final boolean isFullyEstablished() { public final boolean isFullyEstablished() {
return (isEstablished() && ((getNegotiatorState() == JingleNegotiatorState.SUCCEEDED) || (getNegotiatorState() == JingleNegotiatorState.FAILED))); return isEstablished() && ((getNegotiatorState() == JingleNegotiatorState.SUCCEEDED) || (getNegotiatorState() == JingleNegotiatorState.FAILED));
} }
/** /**
@ -303,7 +303,7 @@ public abstract class TransportNegotiator extends JingleNegotiator {
// Sleep for some time, waiting for the candidates checks // Sleep for some time, waiting for the candidates checks
int totalTime = (CANDIDATES_ACCEPT_PERIOD + TransportResolver.CHECK_TIMEOUT); int totalTime = CANDIDATES_ACCEPT_PERIOD + TransportResolver.CHECK_TIMEOUT;
int tries = (int) Math.ceil(totalTime / 1000); int tries = (int) Math.ceil(totalTime / 1000);
for (int i = 0; i < tries - 1; i++) { for (int i = 0; i < tries - 1; i++) {

View File

@ -78,7 +78,7 @@ public class OfflineSettings extends SimpleIQ {
} }
public boolean redirects() { public boolean redirects() {
return (StringUtils.isNotEmpty(getRedirectURL())); return StringUtils.isNotEmpty(getRedirectURL());
} }
public boolean isConfigured() { public boolean isConfigured() {

View File

@ -149,8 +149,8 @@ public class SignalOmemoRatchet
} }
// TODO: Figure out, if this is enough... // TODO: Figure out, if this is enough...
int type = (ciphertextMessage.getType() == CiphertextMessage.PREKEY_TYPE ? int type = ciphertextMessage.getType() == CiphertextMessage.PREKEY_TYPE ?
OmemoElement.TYPE_OMEMO_PREKEY_MESSAGE : OmemoElement.TYPE_OMEMO_MESSAGE); OmemoElement.TYPE_OMEMO_PREKEY_MESSAGE : OmemoElement.TYPE_OMEMO_MESSAGE;
return new CiphertextTuple(ciphertextMessage.serialize(), type); return new CiphertextTuple(ciphertextMessage.serialize(), type);
} }

View File

@ -135,7 +135,7 @@ public class SignalOmemoStoreConnector
@Override @Override
public boolean containsPreKey(int i) { public boolean containsPreKey(int i) {
try { try {
return (loadPreKey(i) != null); return loadPreKey(i) != null;
} catch (InvalidKeyIdException e) { } catch (InvalidKeyIdException e) {
return false; return false;
} }

View File

@ -113,7 +113,7 @@ public abstract class FileBasedOmemoStore<T_IdKeyPair, T_IdKey, T_PreKey, T_SigP
SortedSet<Integer> deviceIds = new TreeSet<>(); SortedSet<Integer> deviceIds = new TreeSet<>();
File userDir = hierarchy.getUserDirectory(localUser); File userDir = hierarchy.getUserDirectory(localUser);
File[] list = userDir.listFiles(); File[] list = userDir.listFiles();
for (File d : (list != null ? list : new File[] {})) { for (File d : list != null ? list : new File[] {}) {
if (d.isDirectory()) { if (d.isDirectory()) {
try { try {
deviceIds.add(Integer.parseInt(d.getName())); deviceIds.add(Integer.parseInt(d.getName()));

View File

@ -60,7 +60,6 @@ public class OpenPgpMessage {
* Represents a {@link CryptElement}. * Represents a {@link CryptElement}.
*/ */
crypt, crypt,
;
} }
private final String element; private final String element;

View File

@ -160,7 +160,7 @@ public abstract class OpenPgpContentElement implements ExtensionElement {
} }
protected void addCommonXml(XmlStringBuilder xml) { protected void addCommonXml(XmlStringBuilder xml) {
for (Jid toJid : (to != null ? to : Collections.<Jid>emptySet())) { for (Jid toJid : to != null ? to : Collections.<Jid>emptySet()) {
xml.halfOpenElement(ELEM_TO).attribute(ATTR_JID, toJid).closeEmptyElement(); xml.halfOpenElement(ELEM_TO).attribute(ATTR_JID, toJid).closeEmptyElement();
} }

View File

@ -173,7 +173,7 @@ public class SASLDigestMD5Mechanism extends SASLMechanism {
String serverResponse = null; String serverResponse = null;
for (String part : challengeParts) { for (String part : challengeParts) {
String[] keyValue = part.split("="); String[] keyValue = part.split("=");
assert (keyValue.length == 2); assert keyValue.length == 2;
String key = keyValue[0]; String key = keyValue[0];
String value = keyValue[1]; String value = keyValue[1];
if ("rspauth".equals(key)) { if ("rspauth".equals(key)) {

View File

@ -569,7 +569,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
int port = hostAddress.getPort(); int port = hostAddress.getPort();
if (proxyInfo == null) { if (proxyInfo == null) {
inetAddresses = hostAddress.getInetAddresses().iterator(); inetAddresses = hostAddress.getInetAddresses().iterator();
assert (inetAddresses.hasNext()); assert inetAddresses.hasNext();
innerloop: while (inetAddresses.hasNext()) { innerloop: while (inetAddresses.hasNext()) {
// Create a *new* Socket before every connection attempt, i.e. connect() call, since Sockets are not // Create a *new* Socket before every connection attempt, i.e. connect() call, since Sockets are not

View File

@ -229,7 +229,7 @@ public class XmppNioTcpConnection extends AbstractXmppNioConnection {
notifyConnectionError(ise); notifyConnectionError(ise);
return; return;
} }
assert (config.getXMPPServiceDomain().equals(reportedServerDomain)); assert config.getXMPPServiceDomain().equals(reportedServerDomain);
break; break;
case "xmlns": case "xmlns":
streamOpen.append(" xmlns='").append(attributeValue).append('\''); streamOpen.append(" xmlns='").append(attributeValue).append('\'');
@ -513,7 +513,7 @@ public class XmppNioTcpConnection extends AbstractXmppNioConnection {
} else { } else {
outgoingCharSequenceIterator = Collections.singletonList(nextCharSequence).iterator(); outgoingCharSequenceIterator = Collections.singletonList(nextCharSequence).iterator();
} }
assert (outgoingCharSequenceIterator != null); assert outgoingCharSequenceIterator != null;
} else { } else {
// There is nothing more to write. // There is nothing more to write.
break; break;
@ -1067,7 +1067,6 @@ public class XmppNioTcpConnection extends AbstractXmppNioConnection {
initiated, initiated,
successful, successful,
failed, failed,
;
} }
private static final Level SSL_ENGINE_DEBUG_LOG_LEVEL = Level.FINEST; private static final Level SSL_ENGINE_DEBUG_LOG_LEVEL = Level.FINEST;
@ -1282,7 +1281,7 @@ public class XmppNioTcpConnection extends AbstractXmppNioConnection {
return null; return null;
case BUFFER_OVERFLOW: case BUFFER_OVERFLOW:
int applicationBufferSize = engine.getSession().getApplicationBufferSize(); int applicationBufferSize = engine.getSession().getApplicationBufferSize();
assert (peerAppData.remaining() < applicationBufferSize); assert peerAppData.remaining() < applicationBufferSize;
peerAppData = ByteBuffer.allocate(applicationBufferSize); peerAppData = ByteBuffer.allocate(applicationBufferSize);
continue; continue;
} }