1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 17:19:39 +02:00

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

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

View file

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

View file

@ -757,7 +757,7 @@ public class InBandBytestreamSession implements BytestreamSession {
bufferPointer = 0;
// 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,
int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException,
IOException, SmackTextParseException {
String stampString = (parser.getAttributeValue("", "stamp"));
String stampString = parser.getAttributeValue("", "stamp");
String from = parser.getAttributeValue("", "from");
final String reason;
XmlPullParser.Event event = parser.next();

View file

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

View file

@ -214,7 +214,7 @@ public final class LastActivityManager extends Manager {
private long getIdleTime() {
long lms = lastMessageSent;
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 {
initiator,
responder,
;
}

View file

@ -208,7 +208,7 @@ public class RoomInfo {
FormField subjectmodField = form.getField("muc#roominfo_subjectmod");
if (subjectmodField != null && !subjectmodField.getValues().isEmpty()) {
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");

View file

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

View file

@ -37,5 +37,5 @@ public enum AccessModel {
roster,
/** 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() {
if (jid != null && affiliation != null) {
assert (node == null && namespace == AffiliationNamespace.owner);
assert node == null && namespace == AffiliationNamespace.owner;
return true;
}
return false;

View file

@ -30,5 +30,5 @@ public enum ChildrenAssociationPolicy {
owners,
/** 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)
return Collections.emptyList();
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.List;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.xdata.Form;
import org.jivesoftware.smackx.xdata.FormField;
import org.jivesoftware.smackx.xdata.packet.DataForm;
@ -246,7 +247,7 @@ public class ConfigureForm extends Form {
* @return true if it does, false otherwise
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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
*/
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();
}
private static boolean parseBoolean(String fieldValue) {
return ("1".equals(fieldValue) || "true".equals(fieldValue));
}
private String getFieldValue(ConfigureNodeFields field) {
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.
*/
public boolean isDelayed() {
return (originalDate != null);
return originalDate != null;
}
/**

View file

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

View file

@ -70,7 +70,7 @@ public enum PubSubElementType {
public static PubSubElementType valueOfFromElemName(String elemName, String namespace) {
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) {
return valueOf((elemName + '_' + fragment).toUpperCase(Locale.US));

View file

@ -23,6 +23,7 @@ import java.util.Date;
import java.util.List;
import java.util.UnknownFormatConversionException;
import org.jivesoftware.smack.util.ParserUtils;
import org.jivesoftware.smackx.xdata.Form;
import org.jivesoftware.smackx.xdata.FormField;
import org.jivesoftware.smackx.xdata.packet.DataForm;
@ -58,7 +59,7 @@ public class SubscribeForm extends Form {
* @return true if want to receive, false otherwise
*/
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
*/
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
*/
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);
}
private static boolean parseBoolean(String fieldValue) {
return ("1".equals(fieldValue) || "true".equals(fieldValue));
}
private String getFieldValue(SubscribeOptionFields field) {
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 (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
*/
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
public void mucMemoryLeakTest() throws XmppStringprepException, IllegalArgumentException, InterruptedException {
MemoryLeakTestUtil.noResourceLeakTest((c) -> MultiUserChatManager.getInstanceFor(c));
MemoryLeakTestUtil.noResourceLeakTest(c -> MultiUserChatManager.getInstanceFor(c));
}
}