1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 13:32:07 +01:00

Add "whitespace after comma" checkstyle rule

This commit is contained in:
Florian Schmaus 2019-05-17 21:56:46 +02:00
parent db5f6f648c
commit f7762c5db7
37 changed files with 59 additions and 58 deletions

View file

@ -142,6 +142,7 @@
, LITERAL_DO
, LITERAL_FOR
, DO_WHILE
, COMMA
"/>
</module>
<module name="WhitespaceAround">

View file

@ -2055,10 +2055,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
ByteArrayInputStream config = new ByteArrayInputStream(pkcs11Config.getBytes(StandardCharsets.UTF_8));
Provider p = (Provider) c.newInstance(config);
Security.addProvider(p);
ks = KeyStore.getInstance("PKCS11",p);
pcb = new PasswordCallback("PKCS11 Password: ",false);
ks = KeyStore.getInstance("PKCS11", p);
pcb = new PasswordCallback("PKCS11 Password: ", false);
callbackHandler.handle(new Callback[] {pcb});
ks.load(null,pcb.getPassword());
ks.load(null, pcb.getPassword());
}
catch (Exception e) {
LOGGER.log(Level.WARNING, "Exception", e);
@ -2066,8 +2066,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
}
}
else if ("Apple".equals(keyStoreType)) {
ks = KeyStore.getInstance("KeychainStore","Apple");
ks.load(null,null);
ks = KeyStore.getInstance("KeychainStore", "Apple");
ks.load(null, null);
// pcb = new PasswordCallback("Apple Keychain",false);
// pcb.setPassword(null);
}

View file

@ -156,7 +156,7 @@ public abstract class ConnectionConfiguration {
private final boolean compressionEnabled;
protected ConnectionConfiguration(Builder<?,?> builder) {
protected ConnectionConfiguration(Builder<?, ?> builder) {
authzid = builder.authzid;
username = builder.username;
password = builder.password;

View file

@ -52,7 +52,7 @@ public class DefaultExtensionElement implements ExtensionElement {
private String elementName;
private String namespace;
private Map<String,String> map;
private Map<String, String> map;
/**
* Creates a new generic stanza extension.
@ -107,7 +107,7 @@ public class DefaultExtensionElement implements ExtensionElement {
if (map == null) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(new HashMap<String,String>(map).keySet());
return Collections.unmodifiableSet(new HashMap<String, String>(map).keySet());
}
/**
@ -131,7 +131,7 @@ public class DefaultExtensionElement implements ExtensionElement {
*/
public synchronized void setValue(String name, String value) {
if (map == null) {
map = new HashMap<String,String>();
map = new HashMap<String, String>();
}
map.put(name, value);
}

View file

@ -150,7 +150,7 @@ public interface Packet extends TopLevelStreamElement {
/**
* Returns the first extension of this stanza that has the given namespace.
* <p>
* When possible, use {@link #getExtension(String,String)} instead.
* When possible, use {@link #getExtension(String, String)} instead.
* </p>
*
* @param namespace the namespace of the extension that is desired.

View file

@ -333,7 +333,7 @@ public abstract class Stanza implements TopLevelStreamElement {
/**
* Returns the first extension of this stanza that has the given namespace.
* <p>
* When possible, use {@link #getExtension(String,String)} instead.
* When possible, use {@link #getExtension(String, String)} instead.
* </p>
*
* @param namespace the namespace of the extension that is desired.

View file

@ -31,13 +31,13 @@ public class SASLErrorException extends XMPPException {
private final SASLFailure saslFailure;
private final String mechanism;
private final Map<String,String> texts;
private final Map<String, String> texts;
public SASLErrorException(String mechanism, SASLFailure saslFailure) {
this(mechanism, saslFailure, new HashMap<String, String>());
}
public SASLErrorException(String mechanism, SASLFailure saslFailure, Map<String,String> texts) {
public SASLErrorException(String mechanism, SASLFailure saslFailure, Map<String, String> texts) {
super("SASLError using " + mechanism + ": " + saslFailure.getSASLErrorString());
this.mechanism = mechanism;
this.saslFailure = saslFailure;
@ -52,7 +52,7 @@ public class SASLErrorException extends XMPPException {
return mechanism;
}
public Map<String,String> getTexts() {
public Map<String, String> getTexts() {
return texts;
}
}

View file

@ -16,7 +16,7 @@
*/
package org.jivesoftware.smack.util;
public interface CallbackRecipient<V,E> {
public interface CallbackRecipient<V, E> {
CallbackRecipient<V, E> onSuccess(SuccessCallback<V> successCallback);

View file

@ -34,7 +34,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public class EventManger<K, R, E extends Exception> {
private final Map<K,Reference<R>> events = new ConcurrentHashMap<>();
private final Map<K, Reference<R>> events = new ConcurrentHashMap<>();
/**
* Perform an action and wait for an event.

View file

@ -33,7 +33,7 @@ import java.util.Set;
* @param <K> the type of the keys the map uses.
* @param <V> the type of the values the map uses.
*/
public class MultiMap<K,V> {
public class MultiMap<K, V> {
/**
* The constant value {@value}.

View file

@ -64,7 +64,7 @@ public class TLSUtils {
*
* @return the given builder
*/
public static <B extends ConnectionConfiguration.Builder<B,?>> B setTLSOnly(B builder) {
public static <B extends ConnectionConfiguration.Builder<B, ?>> B setTLSOnly(B builder) {
builder.setEnabledSSLProtocols(new String[] { PROTO_TLSV1_2, PROTO_TLSV1_1, PROTO_TLSV1 });
return builder;
}
@ -84,7 +84,7 @@ public class TLSUtils {
*
* @return the given builder
*/
public static <B extends ConnectionConfiguration.Builder<B,?>> B setSSLv3AndTLSOnly(B builder) {
public static <B extends ConnectionConfiguration.Builder<B, ?>> B setSSLv3AndTLSOnly(B builder) {
builder.setEnabledSSLProtocols(new String[] { PROTO_TLSV1_2, PROTO_TLSV1_1, PROTO_TLSV1, PROTO_SSL3 });
return builder;
}
@ -103,7 +103,7 @@ public class TLSUtils {
* @throws KeyManagementException
* @return the given builder.
*/
public static <B extends ConnectionConfiguration.Builder<B,?>> B acceptAllCertificates(B builder) throws NoSuchAlgorithmException, KeyManagementException {
public static <B extends ConnectionConfiguration.Builder<B, ?>> B acceptAllCertificates(B builder) throws NoSuchAlgorithmException, KeyManagementException {
SSLContext context = SSLContext.getInstance(TLS);
context.init(null, new TrustManager[] { new AcceptAllTrustManager() }, new SecureRandom());
builder.setCustomSSLContext(context);
@ -130,7 +130,7 @@ public class TLSUtils {
* @param <B> Type of the ConnectionConfiguration builder.
* @return the given builder.
*/
public static <B extends ConnectionConfiguration.Builder<B,?>> B disableHostnameVerificationForTlsCertificates(B builder) {
public static <B extends ConnectionConfiguration.Builder<B, ?>> B disableHostnameVerificationForTlsCertificates(B builder) {
builder.setHostnameVerifier(DOES_NOT_VERIFY_VERIFIER);
return builder;
}

View file

@ -87,11 +87,11 @@ public class ConsistentColor {
}
/**
* Convert an angle in the CbCr plane to values cb,cr in the YCbCr color space.
* Convert an angle in the CbCr plane to values cb, cr in the YCbCr color space.
* @see <a href="https://xmpp.org/extensions/xep-0392.html#algorithm-cbcr">§5.3: CbCr generation</a>
*
* @param angle angel in CbCr plane.
* @return value pair cb,cr
* @return value pair cb, cr
*/
private static double[] angleToCbCr(double angle) {
double cb = Math.cos(angle);
@ -113,11 +113,11 @@ public class ConsistentColor {
}
/**
* Convert a value pair cb,cr in the YCbCr color space to RGB.
* Convert a value pair cb, cr in the YCbCr color space to RGB.
* @see <a href="https://xmpp.org/extensions/xep-0392.html#algorithm-rgb">§5.4: CbCr to RGB</a>
*
* @param cbcr value pair from the YCbCr color space
* @return RGB value triple (R,G,B in [0,1])
* @return RGB value triple (R, G, B in [0,1])
*/
private static float[] CbCrToRGB(double[] cbcr, double y) {
double cb = cbcr[0];

View file

@ -180,7 +180,7 @@ public class MessageMarkupTest extends SmackTestSuite {
public void listWrongSecondEntryTest() {
MarkupElement.Builder m = MarkupElement.getBuilder();
assertThrows(IllegalArgumentException.class, () ->
m.beginList().addEntry(0,1).addEntry(3,4));
m.beginList().addEntry(0, 1).addEntry(3, 4));
}
@Test
@ -190,7 +190,7 @@ public class MessageMarkupTest extends SmackTestSuite {
"<bquote start='9' end='32'/>" +
"</markup>";
MarkupElement.Builder m = MarkupElement.getBuilder();
m.setBlockQuote(9 ,32);
m.setBlockQuote(9, 32);
assertXmlSimilar(xml, m.build().toXML().toString());
XmlPullParser parser = TestUtils.getParser(xml);

View file

@ -58,7 +58,7 @@ public class EntityUseCases extends SingleUserTestCase
int count = 0;
for(Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext(); it.next(),count++);
for(Iterator<DiscoverItems.Item> it = items.getItems(); it.hasNext(); it.next(), count++);
assertEquals(4, count);
}

View file

@ -266,7 +266,7 @@ public final class PrivateDataManager extends Manager {
}
else if (event == XmlPullParser.Event.END_ELEMENT) {
// If an empty element, set the value with the empty string.
data.setValue(name,"");
data.setValue(name, "");
}
}
else if (event == XmlPullParser.Event.END_ELEMENT) {

View file

@ -307,7 +307,7 @@ public final class AccountManager extends Manager {
}
Map<String, String> map = new HashMap<>();
map.put("username", connection().getUser().getLocalpart().toString());
map.put("password",newPassword);
map.put("password", newPassword);
Registration reg = new Registration(map);
reg.setType(IQ.Type.set);
reg.setTo(connection().getXMPPServiceDomain());

View file

@ -477,7 +477,7 @@ public final class MultiUserChatManager extends Manager {
/**
* Set a callback invoked by this manager when automatic join on reconnect failed. If failedCallback is not
* <code>null</code>,then automatic rejoin get also enabled.
* <code>null</code>, then automatic rejoin get also enabled.
*
* @param failedCallback the callback.
*/

View file

@ -357,7 +357,7 @@ public final class VCard extends IQ {
/**
* Set the avatar for the VCard by specifying the url to the image.
*
* @param avatarURL the url to the image(png,jpeg,gif,bmp)
* @param avatarURL the url to the image(png, jpeg, gif, bmp)
*/
public void setAvatar(URL avatarURL) {
byte[] bytes = new byte[0];

View file

@ -78,7 +78,7 @@ public class Form {
/**
* Creates a new Form of a given type from scratch.
*
* @param type the form's type (e.g. form, submit,cancel,result).
* @param type the form's type (e.g. form, submit, cancel, result).
*/
public Form(DataForm.Type type) {
this.dataForm = new DataForm(type);

View file

@ -64,7 +64,7 @@ public class DataValidationProvider {
);
break;
case RegexValidateElement.METHOD:
dataValidation = new RegexValidateElement(dataType,parser.nextText());
dataValidation = new RegexValidateElement(dataType, parser.nextText());
break;
case ListRange.ELEMENT:
Long min = ParserUtils.getLongAttribute(parser, "min");

View file

@ -126,7 +126,7 @@ public class DataFormTest {
FormField field = new FormField("testField1");
df.addField(field);
ValidateElement dv = new RangeValidateElement("xs:integer","1111", "9999");
ValidateElement dv = new RangeValidateElement("xs:integer", "1111", "9999");
field.setValidateElement(dv);
assertNotNull(df.toXML());

View file

@ -89,7 +89,7 @@ public class DataValidationHelperTest {
public void testCheckConsistencyFormFieldRangeValidateElement() {
FormField field = new FormField("var");
field.setType(FormField.Type.text_multi);
RangeValidateElement element = new RangeValidateElement("xs:integer",null, "99");
RangeValidateElement element = new RangeValidateElement("xs:integer", null, "99");
try {
element.checkConsistency(field);
fail("No correct check on consistency");

View file

@ -1414,7 +1414,7 @@ public final class Roster extends Manager {
move(user, presenceMap, nonRosterPresenceMap);
deletedEntries.add(user);
for (Entry<String,RosterGroup> e : groups.entrySet()) {
for (Entry<String, RosterGroup> e : groups.entrySet()) {
RosterGroup group = e.getValue();
group.removeEntryLocal(entry);
if (group.getEntryCount() == 0) {

View file

@ -118,7 +118,7 @@ public class DirectoryRosterStoreTest {
item2.setSubscriptionPending(true);
item2.setItemType(ItemType.none);
item2.setApproved(true);
store.addEntry(item2,version2);
store.addEntry(item2, version2);
assertEquals("Updating entry sets version correctly", version2, store.getRosterVersion());
storedItem = store.getEntry(userName);
assertNotNull("Added entry not found", storedItem);

View file

@ -41,9 +41,9 @@ public class AbstractOmemoMessageListener implements OmemoMessageListener {
}
private static class SyncPointListener extends AbstractOmemoMessageListener {
protected final ResultSyncPoint<?,?> syncPoint;
protected final ResultSyncPoint<?, ?> syncPoint;
SyncPointListener(ResultSyncPoint<?,?> syncPoint) {
SyncPointListener(ResultSyncPoint<?, ?> syncPoint) {
this.syncPoint = syncPoint;
}

View file

@ -125,7 +125,7 @@ public class OmemoManagerSetupHelper {
}
public static void cleanUpPubSub(OmemoManager omemoManager) {
PubSubManager pm = PubSubManager.getInstanceFor(omemoManager.getConnection(),omemoManager.getOwnJid());
PubSubManager pm = PubSubManager.getInstanceFor(omemoManager.getConnection(), omemoManager.getOwnJid());
try {
omemoManager.requestDeviceListUpdateFor(omemoManager.getOwnJid());
} catch (SmackException.NotConnectedException | InterruptedException | SmackException.NoResponseException | PubSubException.NotALeafNodeException | XMPPException.XMPPErrorException e) {

View file

@ -54,7 +54,7 @@ public class AudioMediaSession extends JingleMediaSession {
*/
public AudioMediaSession(final PayloadType payloadType, final TransportCandidate remote,
final TransportCandidate local, String locator, JingleSession jingleSession) {
super(payloadType, remote, local, locator == null ? "dsound://" : locator,jingleSession);
super(payloadType, remote, local, locator == null ? "dsound://" : locator, jingleSession);
initialize();
}
@ -85,7 +85,7 @@ public class AudioMediaSession extends JingleMediaSession {
remotePort = this.getRemote().getPort();
}
audioChannel = new AudioChannel(new MediaLocator(this.getMediaLocator()), localIp, ip, localPort, remotePort, AudioFormatUtils.getAudioFormat(this.getPayloadType()),this);
audioChannel = new AudioChannel(new MediaLocator(this.getMediaLocator()), localIp, ip, localPort, remotePort, AudioFormatUtils.getAudioFormat(this.getPayloadType()), this);
}
/**

View file

@ -62,7 +62,7 @@ public class SpeexMediaManager extends JingleMediaManager {
*/
@Override
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
return new AudioMediaSession(payloadType, remote, local, null,null);
return new AudioMediaSession(payloadType, remote, local, null, null);
}
/**

View file

@ -390,7 +390,7 @@ public class Workgroup {
* @throws SmackException
* @throws InterruptedException
*/
public void joinQueue(Map<String,Object> metadata, Jid userID) throws XMPPException, SmackException, InterruptedException {
public void joinQueue(Map<String, Object> metadata, Jid userID) throws XMPPException, SmackException, InterruptedException {
// If already in the queue ignore the join request.
if (inQueue) {
throw new IllegalStateException("Already in queue " + workgroupJID);

View file

@ -84,7 +84,7 @@ public class MetaDataUtils {
/**
* Serializes a Map of String name/value pairs into the meta-data XML format.
*
* @param metaData the Map of meta-data as Map&lt;String,List&lt;String&gt;&gt;
* @param metaData the Map of meta-data as Map&lt;String, List&lt;String&gt;&gt;
* @return the meta-data values in XML form.
*/
public static String serializeMetaData(Map<String, List<String>> metaData) {

View file

@ -98,7 +98,7 @@ public final class OmemoManager extends Manager {
private static final Integer UNKNOWN_DEVICE_ID = -1;
final Object LOCK = new Object();
private static final WeakHashMap<XMPPConnection, TreeMap<Integer,OmemoManager>> INSTANCES = new WeakHashMap<>();
private static final WeakHashMap<XMPPConnection, TreeMap<Integer, OmemoManager>> INSTANCES = new WeakHashMap<>();
private final OmemoService<?, ?, ?, ?, ?, ?, ?, ?, ?> service;
private final HashSet<OmemoMessageListener> omemoMessageListeners = new HashSet<>();
@ -157,7 +157,7 @@ public final class OmemoManager extends Manager {
throw new IllegalArgumentException("DeviceId MUST NOT be null and MUST be greater than 0.");
}
TreeMap<Integer,OmemoManager> managersOfConnection = INSTANCES.get(connection);
TreeMap<Integer, OmemoManager> managersOfConnection = INSTANCES.get(connection);
if (managersOfConnection == null) {
managersOfConnection = new TreeMap<>();
INSTANCES.put(connection, managersOfConnection);
@ -938,7 +938,7 @@ public final class OmemoManager extends Manager {
*
* @return omemoService
*/
OmemoService<?,?,?,?,?,?,?,?,?> getOmemoService() {
OmemoService<?, ?, ?, ?, ?, ?, ?, ?, ?> getOmemoService() {
throwIfNoServiceSet();
return service;
}

View file

@ -133,7 +133,7 @@ public abstract class OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
// copy key part into messageKey
System.arraycopy(unpackedKey, 0, messageKey, 0, 16);
// copy tag part into authTag
System.arraycopy(unpackedKey, 16, authTag, 0,16);
System.arraycopy(unpackedKey, 16, authTag, 0, 16);
} else if (element.isKeyTransportElement() && unpackedKey.length == 16) {
messageKey = unpackedKey;
} else {

View file

@ -123,7 +123,7 @@ extends SmackTestSuite {
int high = Integer.MAX_VALUE - 2;
int max = Integer.MAX_VALUE;
assertEquals(OmemoKeyUtil.addInBounds(high, 3), 1);
assertEquals(OmemoKeyUtil.addInBounds(1,2), 3);
assertEquals(OmemoKeyUtil.addInBounds(1, 2), 3);
assertEquals(OmemoKeyUtil.addInBounds(max, 5), 5);
}

View file

@ -269,8 +269,8 @@ public abstract class OmemoStoreTest<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey
@Test
public void loadStoreCachedDeviceList() throws IOException {
Integer[] active = new Integer[] {1,5,999,10};
Integer[] inactive = new Integer[] {6,7,8};
Integer[] active = new Integer[] {1, 5, 999, 10};
Integer[] inactive = new Integer[] {6, 7, 8};
OmemoCachedDeviceList before = new OmemoCachedDeviceList(
new HashSet<>(Arrays.asList(active)),
new HashSet<>(Arrays.asList(inactive)));

View file

@ -113,7 +113,7 @@ public abstract class OpenPgpContentElement implements ExtensionElement {
/**
* Returns the first extension of this stanza that has the given namespace.
* <p>
* When possible, use {@link #getExtension(String,String)} instead.
* When possible, use {@link #getExtension(String, String)} instead.
* </p>
*
* @param namespace the namespace of the extension that is desired.

View file

@ -30,8 +30,8 @@ public class SASLGSSAPIMechanism extends SASLJavaXMechanism {
public static final String NAME = GSSAPI;
static {
System.setProperty("javax.security.auth.useSubjectCredsOnly","false");
System.setProperty("java.security.auth.login.config","gss.conf");
System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
System.setProperty("java.security.auth.login.config", "gss.conf");
}
@Override
@ -47,7 +47,7 @@ public class SASLGSSAPIMechanism extends SASLJavaXMechanism {
@Override
protected Map<String, String> getSaslProps() {
Map<String, String> props = super.getSaslProps();
props.put(Sasl.SERVER_AUTH,"TRUE");
props.put(Sasl.SERVER_AUTH, "TRUE");
return props;
}

View file

@ -145,7 +145,7 @@ public abstract class SASLJavaXMechanism extends SASLMechanism {
}
}
protected Map<String,String> getSaslProps() {
protected Map<String, String> getSaslProps() {
return new HashMap<>();
}