mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 09:09:38 +02:00
Enable MissingJavadocPackage and UnnecessaryParentheses checkstyle checks
This commit is contained in:
parent
2ac452fe1e
commit
4ca2c7cc69
76 changed files with 120 additions and 131 deletions
|
@ -755,7 +755,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
hostAddresses = DNSUtil.resolveXMPPServiceDomain(dnsName, failedAddresses, config.getDnssecMode());
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -788,7 +788,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
@Override
|
||||
public final void sendStanza(Stanza stanza) throws NotConnectedException, InterruptedException {
|
||||
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();
|
||||
switch (fromMode) {
|
||||
|
@ -1275,7 +1275,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
protected void processStanza(final Stanza stanza) throws InterruptedException {
|
||||
assert (stanza != null);
|
||||
assert stanza != null;
|
||||
|
||||
final SmackDebugger debugger = this.debugger;
|
||||
if (debugger != null) {
|
||||
|
@ -1892,7 +1892,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
@Override
|
||||
public final String toString() {
|
||||
EntityFullJid localEndpoint = getUser();
|
||||
String localEndpointString = (localEndpoint == null ? "not-authenticated" : localEndpoint.toString());
|
||||
String localEndpointString = localEndpoint == null ? "not-authenticated" : localEndpoint.toString();
|
||||
return getClass().getSimpleName() + '[' + localEndpointString + "] (" + getConnectionCounter() + ')';
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ public abstract class ConnectionConfiguration {
|
|||
compressionEnabled = builder.compressionEnabled;
|
||||
|
||||
// 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) {
|
||||
throw new IllegalStateException("You can not use a custom SSL context with DNSSEC enabled");
|
||||
|
|
|
@ -447,6 +447,5 @@ public final class ReconnectionManager {
|
|||
* Policy using fixed amount of time between reconnection attempts.
|
||||
*/
|
||||
FIXED_DELAY,
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public abstract class SmackFuture<V, E extends Exception> implements Future<V>,
|
|||
}
|
||||
|
||||
private V getOrThrowExecutionException() throws ExecutionException {
|
||||
assert (result != null || exception != null || cancelled);
|
||||
assert result != null || exception != null || cancelled;
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public abstract class SmackFuture<V, E extends Exception> implements Future<V>,
|
|||
throw new ExecutionException(exception);
|
||||
}
|
||||
|
||||
assert (cancelled);
|
||||
assert cancelled;
|
||||
throw new CancellationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ public class SmackReactor {
|
|||
LOGGER.info(this + " shut down after " + shutDownDelay + "ms");
|
||||
} else {
|
||||
boolean contained = reactorThreads.remove(this);
|
||||
assert (contained);
|
||||
assert contained;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class SynchronizationPoint<E extends Exception> {
|
|||
*/
|
||||
public Exception sendAndWaitForResponse(TopLevelStreamElement request) throws NoResponseException,
|
||||
NotConnectedException, InterruptedException {
|
||||
assert (state == State.Initial);
|
||||
assert state == State.Initial;
|
||||
connectionLock.lock();
|
||||
try {
|
||||
if (request != null) {
|
||||
|
|
|
@ -56,7 +56,7 @@ public class Java7ZlibInputOutputStream extends XMPPInputOutputStream {
|
|||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
method = m;
|
||||
supported = (method != null);
|
||||
supported = method != null;
|
||||
}
|
||||
|
||||
public Java7ZlibInputOutputStream() {
|
||||
|
|
|
@ -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.
|
||||
assert (compressor.needsInput());
|
||||
assert compressor.needsInput();
|
||||
|
||||
final byte[] compressorInputBuffer;
|
||||
final int compressorInputBufferOffset, compressorInputBufferLength;
|
||||
|
|
|
@ -86,12 +86,12 @@ public abstract class SmackDebugger {
|
|||
*/
|
||||
public final Reader newConnectionReader(Reader reader) {
|
||||
XmlPrettyPrinter xmlPrettyPrinter = XmlPrettyPrinter.builder()
|
||||
.setPrettyWriter((sb) -> incomingStreamSink(sb))
|
||||
.setPrettyWriter(sb -> incomingStreamSink(sb))
|
||||
.build();
|
||||
incomingStreamSplitterForPrettyPrinting = new XmppXmlSplitter(xmlPrettyPrinter);
|
||||
|
||||
ObservableReader observableReader = new ObservableReader(reader);
|
||||
observableReader.addReaderListener((readString) -> {
|
||||
observableReader.addReaderListener(readString -> {
|
||||
try {
|
||||
incomingStreamSplitterForPrettyPrinting.append(readString);
|
||||
}
|
||||
|
@ -113,12 +113,12 @@ public abstract class SmackDebugger {
|
|||
*/
|
||||
public final Writer newConnectionWriter(Writer writer) {
|
||||
XmlPrettyPrinter xmlPrettyPrinter = XmlPrettyPrinter.builder()
|
||||
.setPrettyWriter((sb) -> outgoingStreamSink(sb))
|
||||
.setPrettyWriter(sb -> outgoingStreamSink(sb))
|
||||
.build();
|
||||
outgoingStreamSplitterForPrettyPrinting = new XmppXmlSplitter(xmlPrettyPrinter);
|
||||
|
||||
ObservableWriter observableWriter = new ObservableWriter(writer);
|
||||
observableWriter.addWriterListener((writtenString) -> {
|
||||
observableWriter.addWriterListener(writtenString -> {
|
||||
try {
|
||||
outgoingStreamSplitterForPrettyPrinting.append(writtenString);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2017-2018 Florian Schmaus.
|
||||
* Copyright 2017-2019 Florian Schmaus.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (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,
|
||||
domainBare,
|
||||
any,
|
||||
;
|
||||
}
|
||||
|
||||
protected final JidType jidType;
|
||||
|
|
|
@ -178,7 +178,7 @@ public abstract class AbstractXmppStateMachineConnection extends AbstractXMPPCon
|
|||
|
||||
if (initialStateDescriptor.getClass() == walkStateGraphContext.finalStateClass) {
|
||||
// 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.
|
||||
invokeConnectionStateMachineListener(new ConnectionStateEvent.FinalStateReached(initialState));
|
||||
|
@ -578,7 +578,7 @@ public abstract class AbstractXmppStateMachineConnection extends AbstractXMPPCon
|
|||
|
||||
@Override
|
||||
protected TransitionIntoResult transitionInto(WalkStateGraphContext walkStateGraphContext) {
|
||||
assert (walkFromDisconnectToAuthenticated == null);
|
||||
assert walkFromDisconnectToAuthenticated == null;
|
||||
if (getStateDescriptor().getClass() == walkStateGraphContext.finalStateClass) {
|
||||
// If this is the final state, then record the walk so far.
|
||||
walkFromDisconnectToAuthenticated = new ArrayList<>(walkStateGraphContext.walkedStateGraphPath);
|
||||
|
@ -780,7 +780,7 @@ public abstract class AbstractXmppStateMachineConnection extends AbstractXMPPCon
|
|||
if (walkFromDisconnectToAuthenticated != null) {
|
||||
// If there was already a previous walk to ConnectedButUnauthenticated, then the context of the current
|
||||
// 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);
|
||||
} else {
|
||||
walkFromDisconnectToAuthenticated = new ArrayList<>(walkStateGraphContext.walkedStateGraphPath.size() + 1);
|
||||
|
|
|
@ -326,7 +326,7 @@ public class StateDescriptorGraph {
|
|||
|
||||
private static <E> List<GraphVertex<E>> topologicalSort(Collection<GraphVertex<E>> vertexes) {
|
||||
List<GraphVertex<E>> res = new ArrayList<>();
|
||||
dfs(vertexes, (vertex) -> res.add(0, vertex), null);
|
||||
dfs(vertexes, vertex -> res.add(0, vertex), null);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ public class StateDescriptorGraph {
|
|||
PrintWriter dotOut, boolean breakStateName) {
|
||||
dotOut.append("digraph {\n");
|
||||
dfs(vertexes,
|
||||
(finishedVertex) -> {
|
||||
finishedVertex -> {
|
||||
boolean isMultiVisitState = finishedVertex.element.isMultiVisitState();
|
||||
boolean isFinalState = finishedVertex.element.isFinalState();
|
||||
boolean isNotImplemented = finishedVertex.element.isNotImplemented();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Copyright © 2014 Florian Schmaus
|
||||
* Copyright © 2014-2019 Florian Schmaus
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (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 {
|
||||
client,
|
||||
server;
|
||||
server,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
|
|||
this.password = password;
|
||||
this.authorizationId = authzid;
|
||||
this.sslSession = sslSession;
|
||||
assert (authorizationId == null || authzidSupported());
|
||||
assert authorizationId == null || authzidSupported();
|
||||
authenticateInternal();
|
||||
authenticate();
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public abstract class SASLMechanism implements Comparable<SASLMechanism> {
|
|||
this.serviceName = serviceName;
|
||||
this.authorizationId = authzid;
|
||||
this.sslSession = sslSession;
|
||||
assert (authorizationId == null || authzidSupported());
|
||||
assert authorizationId == null || authzidSupported();
|
||||
authenticateInternal(cbh);
|
||||
authenticate();
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ public abstract class ScramMechanism extends SASLMechanism {
|
|||
}
|
||||
|
||||
String cbName = getChannelBindingName();
|
||||
assert (StringUtils.isNotEmpty(cbName));
|
||||
assert StringUtils.isNotEmpty(cbName);
|
||||
|
||||
return cbName + ',' + authzidPortion + ",";
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ public class DNSUtil {
|
|||
}
|
||||
|
||||
for (SRVRecord r : bucket) {
|
||||
running_total += (r.getWeight() + zeroWeight);
|
||||
running_total += r.getWeight() + zeroWeight;
|
||||
totals[count] = running_total;
|
||||
count++;
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ public class MultiMap<K, V> {
|
|||
if (res == null) {
|
||||
return null;
|
||||
}
|
||||
assert (!res.isEmpty());
|
||||
assert !res.isEmpty();
|
||||
return res.iterator().next();
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ public class PacketParserUtils {
|
|||
*/
|
||||
public static Message parseMessage(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
|
||||
ParserUtils.assertAtStartTag(parser);
|
||||
assert (parser.getName().equals(Message.ELEMENT));
|
||||
assert parser.getName().equals(Message.ELEMENT);
|
||||
|
||||
XmlEnvironment messageXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
|
||||
final int initialDepth = parser.getDepth();
|
||||
|
@ -218,7 +218,7 @@ public class PacketParserUtils {
|
|||
* @throws 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;
|
||||
// Advance to the text of the Element
|
||||
XmlPullParser.Event event = parser.next();
|
||||
|
@ -263,7 +263,7 @@ public class PacketParserUtils {
|
|||
public static CharSequence parseElement(XmlPullParser parser,
|
||||
boolean fullNamespaces) throws XmlPullParserException,
|
||||
IOException {
|
||||
assert (parser.getEventType() == XmlPullParser.Event.START_ELEMENT);
|
||||
assert parser.getEventType() == XmlPullParser.Event.START_ELEMENT;
|
||||
return parseContentDepth(parser, parser.getDepth(), fullNamespaces);
|
||||
}
|
||||
|
||||
|
@ -631,7 +631,7 @@ public class PacketParserUtils {
|
|||
*/
|
||||
public static Compress.Feature parseCompressionFeature(XmlPullParser parser)
|
||||
throws IOException, XmlPullParserException {
|
||||
assert (parser.getEventType() == XmlPullParser.Event.START_ELEMENT);
|
||||
assert parser.getEventType() == XmlPullParser.Event.START_ELEMENT;
|
||||
String name;
|
||||
final int initialDepth = parser.getDepth();
|
||||
List<String> methods = new LinkedList<>();
|
||||
|
@ -660,8 +660,8 @@ public class PacketParserUtils {
|
|||
break;
|
||||
}
|
||||
}
|
||||
assert (parser.getEventType() == XmlPullParser.Event.END_ELEMENT);
|
||||
assert (parser.getDepth() == initialDepth);
|
||||
assert parser.getEventType() == XmlPullParser.Event.END_ELEMENT;
|
||||
assert parser.getDepth() == initialDepth;
|
||||
return new Compress.Feature(methods);
|
||||
}
|
||||
|
||||
|
@ -679,7 +679,7 @@ public class PacketParserUtils {
|
|||
|
||||
String text = parser.nextText();
|
||||
String previousValue = descriptiveTexts.put(xmllang, text);
|
||||
assert (previousValue == null);
|
||||
assert previousValue == null;
|
||||
return descriptiveTexts;
|
||||
}
|
||||
|
||||
|
@ -704,7 +704,7 @@ public class PacketParserUtils {
|
|||
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
|
||||
}
|
||||
else {
|
||||
assert (condition == null);
|
||||
assert condition == null;
|
||||
condition = parser.getName();
|
||||
}
|
||||
break;
|
||||
|
@ -875,8 +875,8 @@ public class PacketParserUtils {
|
|||
|
||||
public static StartTls parseStartTlsFeature(XmlPullParser parser)
|
||||
throws XmlPullParserException, IOException {
|
||||
assert (parser.getEventType() == XmlPullParser.Event.START_ELEMENT);
|
||||
assert (parser.getNamespace().equals(StartTls.NAMESPACE));
|
||||
ParserUtils.assertAtStartTag(parser);
|
||||
assert parser.getNamespace().equals(StartTls.NAMESPACE);
|
||||
int initalDepth = parser.getDepth();
|
||||
boolean required = false;
|
||||
outerloop: while (true) {
|
||||
|
@ -900,7 +900,7 @@ public class PacketParserUtils {
|
|||
break;
|
||||
}
|
||||
}
|
||||
assert (parser.getEventType() == XmlPullParser.Event.END_ELEMENT);
|
||||
ParserUtils.assertAtEndTag(parser);
|
||||
return new StartTls(required);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ParserUtils {
|
|||
public static final String JID = "jid";
|
||||
|
||||
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 {
|
||||
|
@ -59,7 +59,7 @@ public class ParserUtils {
|
|||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -110,7 +110,6 @@ public class StringUtils {
|
|||
forAttribute,
|
||||
forAttributeApos,
|
||||
forText,
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -180,7 +180,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
|||
}
|
||||
|
||||
public XmlStringBuilder halfOpenElement(String name) {
|
||||
assert (StringUtils.isNotEmpty(name));
|
||||
assert StringUtils.isNotEmpty(name);
|
||||
sb.append('<').append(name);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class HostAddress {
|
|||
|
||||
public void setException(InetAddress inetAddress, Exception exception) {
|
||||
Exception old = exceptions.put(inetAddress, exception);
|
||||
assert (old == null);
|
||||
assert old == null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -114,14 +114,14 @@ public class SmackTestUtil {
|
|||
public static XmlPullParser getParserFor(String xml, QName startTagQName, XmlPullParserKind parserKind)
|
||||
throws XmlPullParserException, IOException {
|
||||
XmlPullParser parser = getParserFor(xml, parserKind);
|
||||
forwardParserToStartElement(parser, (p) -> p.getQName().equals(startTagQName));
|
||||
forwardParserToStartElement(parser, p -> p.getQName().equals(startTagQName));
|
||||
return parser;
|
||||
}
|
||||
|
||||
public static XmlPullParser getParserFor(String xml, String startTagLocalpart, XmlPullParserKind parserKind)
|
||||
throws XmlPullParserException, IOException {
|
||||
XmlPullParser parser = getParserFor(xml, parserKind);
|
||||
forwardParserToStartElement(parser, (p) -> p.getName().equals(startTagLocalpart));
|
||||
forwardParserToStartElement(parser, p -> p.getName().equals(startTagLocalpart));
|
||||
return parser;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue