mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +01:00
Add "whitespace after comma" checkstyle rule
This commit is contained in:
parent
db5f6f648c
commit
f7762c5db7
37 changed files with 59 additions and 58 deletions
|
@ -142,6 +142,7 @@
|
||||||
, LITERAL_DO
|
, LITERAL_DO
|
||||||
, LITERAL_FOR
|
, LITERAL_FOR
|
||||||
, DO_WHILE
|
, DO_WHILE
|
||||||
|
, COMMA
|
||||||
"/>
|
"/>
|
||||||
</module>
|
</module>
|
||||||
<module name="WhitespaceAround">
|
<module name="WhitespaceAround">
|
||||||
|
|
|
@ -2055,10 +2055,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
ByteArrayInputStream config = new ByteArrayInputStream(pkcs11Config.getBytes(StandardCharsets.UTF_8));
|
ByteArrayInputStream config = new ByteArrayInputStream(pkcs11Config.getBytes(StandardCharsets.UTF_8));
|
||||||
Provider p = (Provider) c.newInstance(config);
|
Provider p = (Provider) c.newInstance(config);
|
||||||
Security.addProvider(p);
|
Security.addProvider(p);
|
||||||
ks = KeyStore.getInstance("PKCS11",p);
|
ks = KeyStore.getInstance("PKCS11", p);
|
||||||
pcb = new PasswordCallback("PKCS11 Password: ",false);
|
pcb = new PasswordCallback("PKCS11 Password: ", false);
|
||||||
callbackHandler.handle(new Callback[] {pcb});
|
callbackHandler.handle(new Callback[] {pcb});
|
||||||
ks.load(null,pcb.getPassword());
|
ks.load(null, pcb.getPassword());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
LOGGER.log(Level.WARNING, "Exception", e);
|
LOGGER.log(Level.WARNING, "Exception", e);
|
||||||
|
@ -2066,8 +2066,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ("Apple".equals(keyStoreType)) {
|
else if ("Apple".equals(keyStoreType)) {
|
||||||
ks = KeyStore.getInstance("KeychainStore","Apple");
|
ks = KeyStore.getInstance("KeychainStore", "Apple");
|
||||||
ks.load(null,null);
|
ks.load(null, null);
|
||||||
// pcb = new PasswordCallback("Apple Keychain",false);
|
// pcb = new PasswordCallback("Apple Keychain",false);
|
||||||
// pcb.setPassword(null);
|
// pcb.setPassword(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ public abstract class ConnectionConfiguration {
|
||||||
|
|
||||||
private final boolean compressionEnabled;
|
private final boolean compressionEnabled;
|
||||||
|
|
||||||
protected ConnectionConfiguration(Builder<?,?> builder) {
|
protected ConnectionConfiguration(Builder<?, ?> builder) {
|
||||||
authzid = builder.authzid;
|
authzid = builder.authzid;
|
||||||
username = builder.username;
|
username = builder.username;
|
||||||
password = builder.password;
|
password = builder.password;
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class DefaultExtensionElement implements ExtensionElement {
|
||||||
|
|
||||||
private String elementName;
|
private String elementName;
|
||||||
private String namespace;
|
private String namespace;
|
||||||
private Map<String,String> map;
|
private Map<String, String> map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new generic stanza extension.
|
* Creates a new generic stanza extension.
|
||||||
|
@ -107,7 +107,7 @@ public class DefaultExtensionElement implements ExtensionElement {
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
return Collections.emptySet();
|
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) {
|
public synchronized void setValue(String name, String value) {
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
map = new HashMap<String,String>();
|
map = new HashMap<String, String>();
|
||||||
}
|
}
|
||||||
map.put(name, value);
|
map.put(name, value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ public interface Packet extends TopLevelStreamElement {
|
||||||
/**
|
/**
|
||||||
* Returns the first extension of this stanza that has the given namespace.
|
* Returns the first extension of this stanza that has the given namespace.
|
||||||
* <p>
|
* <p>
|
||||||
* When possible, use {@link #getExtension(String,String)} instead.
|
* When possible, use {@link #getExtension(String, String)} instead.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param namespace the namespace of the extension that is desired.
|
* @param namespace the namespace of the extension that is desired.
|
||||||
|
|
|
@ -333,7 +333,7 @@ public abstract class Stanza implements TopLevelStreamElement {
|
||||||
/**
|
/**
|
||||||
* Returns the first extension of this stanza that has the given namespace.
|
* Returns the first extension of this stanza that has the given namespace.
|
||||||
* <p>
|
* <p>
|
||||||
* When possible, use {@link #getExtension(String,String)} instead.
|
* When possible, use {@link #getExtension(String, String)} instead.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param namespace the namespace of the extension that is desired.
|
* @param namespace the namespace of the extension that is desired.
|
||||||
|
|
|
@ -31,13 +31,13 @@ public class SASLErrorException extends XMPPException {
|
||||||
|
|
||||||
private final SASLFailure saslFailure;
|
private final SASLFailure saslFailure;
|
||||||
private final String mechanism;
|
private final String mechanism;
|
||||||
private final Map<String,String> texts;
|
private final Map<String, String> texts;
|
||||||
|
|
||||||
public SASLErrorException(String mechanism, SASLFailure saslFailure) {
|
public SASLErrorException(String mechanism, SASLFailure saslFailure) {
|
||||||
this(mechanism, saslFailure, new HashMap<String, String>());
|
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());
|
super("SASLError using " + mechanism + ": " + saslFailure.getSASLErrorString());
|
||||||
this.mechanism = mechanism;
|
this.mechanism = mechanism;
|
||||||
this.saslFailure = saslFailure;
|
this.saslFailure = saslFailure;
|
||||||
|
@ -52,7 +52,7 @@ public class SASLErrorException extends XMPPException {
|
||||||
return mechanism;
|
return mechanism;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String,String> getTexts() {
|
public Map<String, String> getTexts() {
|
||||||
return texts;
|
return texts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jivesoftware.smack.util;
|
package org.jivesoftware.smack.util;
|
||||||
|
|
||||||
public interface CallbackRecipient<V,E> {
|
public interface CallbackRecipient<V, E> {
|
||||||
|
|
||||||
CallbackRecipient<V, E> onSuccess(SuccessCallback<V> successCallback);
|
CallbackRecipient<V, E> onSuccess(SuccessCallback<V> successCallback);
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||||
*/
|
*/
|
||||||
public class EventManger<K, R, E extends Exception> {
|
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.
|
* Perform an action and wait for an event.
|
||||||
|
|
|
@ -33,7 +33,7 @@ import java.util.Set;
|
||||||
* @param <K> the type of the keys the map uses.
|
* @param <K> the type of the keys the map uses.
|
||||||
* @param <V> the type of the values 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}.
|
* The constant value {@value}.
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class TLSUtils {
|
||||||
*
|
*
|
||||||
* @return the given builder
|
* @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 });
|
builder.setEnabledSSLProtocols(new String[] { PROTO_TLSV1_2, PROTO_TLSV1_1, PROTO_TLSV1 });
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public class TLSUtils {
|
||||||
*
|
*
|
||||||
* @return the given builder
|
* @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 });
|
builder.setEnabledSSLProtocols(new String[] { PROTO_TLSV1_2, PROTO_TLSV1_1, PROTO_TLSV1, PROTO_SSL3 });
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class TLSUtils {
|
||||||
* @throws KeyManagementException
|
* @throws KeyManagementException
|
||||||
* @return the given builder.
|
* @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);
|
SSLContext context = SSLContext.getInstance(TLS);
|
||||||
context.init(null, new TrustManager[] { new AcceptAllTrustManager() }, new SecureRandom());
|
context.init(null, new TrustManager[] { new AcceptAllTrustManager() }, new SecureRandom());
|
||||||
builder.setCustomSSLContext(context);
|
builder.setCustomSSLContext(context);
|
||||||
|
@ -130,7 +130,7 @@ public class TLSUtils {
|
||||||
* @param <B> Type of the ConnectionConfiguration builder.
|
* @param <B> Type of the ConnectionConfiguration builder.
|
||||||
* @return the given 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);
|
builder.setHostnameVerifier(DOES_NOT_VERIFY_VERIFIER);
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
* @see <a href="https://xmpp.org/extensions/xep-0392.html#algorithm-cbcr">§5.3: CbCr generation</a>
|
||||||
*
|
*
|
||||||
* @param angle angel in CbCr plane.
|
* @param angle angel in CbCr plane.
|
||||||
* @return value pair cb,cr
|
* @return value pair cb, cr
|
||||||
*/
|
*/
|
||||||
private static double[] angleToCbCr(double angle) {
|
private static double[] angleToCbCr(double angle) {
|
||||||
double cb = Math.cos(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>
|
* @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
|
* @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) {
|
private static float[] CbCrToRGB(double[] cbcr, double y) {
|
||||||
double cb = cbcr[0];
|
double cb = cbcr[0];
|
||||||
|
|
|
@ -180,7 +180,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
public void listWrongSecondEntryTest() {
|
public void listWrongSecondEntryTest() {
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
assertThrows(IllegalArgumentException.class, () ->
|
assertThrows(IllegalArgumentException.class, () ->
|
||||||
m.beginList().addEntry(0,1).addEntry(3,4));
|
m.beginList().addEntry(0, 1).addEntry(3, 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -190,7 +190,7 @@ public class MessageMarkupTest extends SmackTestSuite {
|
||||||
"<bquote start='9' end='32'/>" +
|
"<bquote start='9' end='32'/>" +
|
||||||
"</markup>";
|
"</markup>";
|
||||||
MarkupElement.Builder m = MarkupElement.getBuilder();
|
MarkupElement.Builder m = MarkupElement.getBuilder();
|
||||||
m.setBlockQuote(9 ,32);
|
m.setBlockQuote(9, 32);
|
||||||
assertXmlSimilar(xml, m.build().toXML().toString());
|
assertXmlSimilar(xml, m.build().toXML().toString());
|
||||||
|
|
||||||
XmlPullParser parser = TestUtils.getParser(xml);
|
XmlPullParser parser = TestUtils.getParser(xml);
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class EntityUseCases extends SingleUserTestCase
|
||||||
|
|
||||||
int count = 0;
|
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);
|
assertEquals(4, count);
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,7 +266,7 @@ public final class PrivateDataManager extends Manager {
|
||||||
}
|
}
|
||||||
else if (event == XmlPullParser.Event.END_ELEMENT) {
|
else if (event == XmlPullParser.Event.END_ELEMENT) {
|
||||||
// If an empty element, set the value with the empty string.
|
// If an empty element, set the value with the empty string.
|
||||||
data.setValue(name,"");
|
data.setValue(name, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event == XmlPullParser.Event.END_ELEMENT) {
|
else if (event == XmlPullParser.Event.END_ELEMENT) {
|
||||||
|
|
|
@ -307,7 +307,7 @@ public final class AccountManager extends Manager {
|
||||||
}
|
}
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put("username", connection().getUser().getLocalpart().toString());
|
map.put("username", connection().getUser().getLocalpart().toString());
|
||||||
map.put("password",newPassword);
|
map.put("password", newPassword);
|
||||||
Registration reg = new Registration(map);
|
Registration reg = new Registration(map);
|
||||||
reg.setType(IQ.Type.set);
|
reg.setType(IQ.Type.set);
|
||||||
reg.setTo(connection().getXMPPServiceDomain());
|
reg.setTo(connection().getXMPPServiceDomain());
|
||||||
|
|
|
@ -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
|
* 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.
|
* @param failedCallback the callback.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -357,7 +357,7 @@ public final class VCard extends IQ {
|
||||||
/**
|
/**
|
||||||
* Set the avatar for the VCard by specifying the url to the image.
|
* 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) {
|
public void setAvatar(URL avatarURL) {
|
||||||
byte[] bytes = new byte[0];
|
byte[] bytes = new byte[0];
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class Form {
|
||||||
/**
|
/**
|
||||||
* Creates a new Form of a given type from scratch.
|
* 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) {
|
public Form(DataForm.Type type) {
|
||||||
this.dataForm = new DataForm(type);
|
this.dataForm = new DataForm(type);
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class DataValidationProvider {
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case RegexValidateElement.METHOD:
|
case RegexValidateElement.METHOD:
|
||||||
dataValidation = new RegexValidateElement(dataType,parser.nextText());
|
dataValidation = new RegexValidateElement(dataType, parser.nextText());
|
||||||
break;
|
break;
|
||||||
case ListRange.ELEMENT:
|
case ListRange.ELEMENT:
|
||||||
Long min = ParserUtils.getLongAttribute(parser, "min");
|
Long min = ParserUtils.getLongAttribute(parser, "min");
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class DataFormTest {
|
||||||
FormField field = new FormField("testField1");
|
FormField field = new FormField("testField1");
|
||||||
df.addField(field);
|
df.addField(field);
|
||||||
|
|
||||||
ValidateElement dv = new RangeValidateElement("xs:integer","1111", "9999");
|
ValidateElement dv = new RangeValidateElement("xs:integer", "1111", "9999");
|
||||||
field.setValidateElement(dv);
|
field.setValidateElement(dv);
|
||||||
|
|
||||||
assertNotNull(df.toXML());
|
assertNotNull(df.toXML());
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class DataValidationHelperTest {
|
||||||
public void testCheckConsistencyFormFieldRangeValidateElement() {
|
public void testCheckConsistencyFormFieldRangeValidateElement() {
|
||||||
FormField field = new FormField("var");
|
FormField field = new FormField("var");
|
||||||
field.setType(FormField.Type.text_multi);
|
field.setType(FormField.Type.text_multi);
|
||||||
RangeValidateElement element = new RangeValidateElement("xs:integer",null, "99");
|
RangeValidateElement element = new RangeValidateElement("xs:integer", null, "99");
|
||||||
try {
|
try {
|
||||||
element.checkConsistency(field);
|
element.checkConsistency(field);
|
||||||
fail("No correct check on consistency");
|
fail("No correct check on consistency");
|
||||||
|
|
|
@ -1414,7 +1414,7 @@ public final class Roster extends Manager {
|
||||||
move(user, presenceMap, nonRosterPresenceMap);
|
move(user, presenceMap, nonRosterPresenceMap);
|
||||||
deletedEntries.add(user);
|
deletedEntries.add(user);
|
||||||
|
|
||||||
for (Entry<String,RosterGroup> e : groups.entrySet()) {
|
for (Entry<String, RosterGroup> e : groups.entrySet()) {
|
||||||
RosterGroup group = e.getValue();
|
RosterGroup group = e.getValue();
|
||||||
group.removeEntryLocal(entry);
|
group.removeEntryLocal(entry);
|
||||||
if (group.getEntryCount() == 0) {
|
if (group.getEntryCount() == 0) {
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class DirectoryRosterStoreTest {
|
||||||
item2.setSubscriptionPending(true);
|
item2.setSubscriptionPending(true);
|
||||||
item2.setItemType(ItemType.none);
|
item2.setItemType(ItemType.none);
|
||||||
item2.setApproved(true);
|
item2.setApproved(true);
|
||||||
store.addEntry(item2,version2);
|
store.addEntry(item2, version2);
|
||||||
assertEquals("Updating entry sets version correctly", version2, store.getRosterVersion());
|
assertEquals("Updating entry sets version correctly", version2, store.getRosterVersion());
|
||||||
storedItem = store.getEntry(userName);
|
storedItem = store.getEntry(userName);
|
||||||
assertNotNull("Added entry not found", storedItem);
|
assertNotNull("Added entry not found", storedItem);
|
||||||
|
|
|
@ -41,9 +41,9 @@ public class AbstractOmemoMessageListener implements OmemoMessageListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SyncPointListener extends AbstractOmemoMessageListener {
|
private static class SyncPointListener extends AbstractOmemoMessageListener {
|
||||||
protected final ResultSyncPoint<?,?> syncPoint;
|
protected final ResultSyncPoint<?, ?> syncPoint;
|
||||||
|
|
||||||
SyncPointListener(ResultSyncPoint<?,?> syncPoint) {
|
SyncPointListener(ResultSyncPoint<?, ?> syncPoint) {
|
||||||
this.syncPoint = syncPoint;
|
this.syncPoint = syncPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ public class OmemoManagerSetupHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void cleanUpPubSub(OmemoManager omemoManager) {
|
public static void cleanUpPubSub(OmemoManager omemoManager) {
|
||||||
PubSubManager pm = PubSubManager.getInstanceFor(omemoManager.getConnection(),omemoManager.getOwnJid());
|
PubSubManager pm = PubSubManager.getInstanceFor(omemoManager.getConnection(), omemoManager.getOwnJid());
|
||||||
try {
|
try {
|
||||||
omemoManager.requestDeviceListUpdateFor(omemoManager.getOwnJid());
|
omemoManager.requestDeviceListUpdateFor(omemoManager.getOwnJid());
|
||||||
} catch (SmackException.NotConnectedException | InterruptedException | SmackException.NoResponseException | PubSubException.NotALeafNodeException | XMPPException.XMPPErrorException e) {
|
} catch (SmackException.NotConnectedException | InterruptedException | SmackException.NoResponseException | PubSubException.NotALeafNodeException | XMPPException.XMPPErrorException e) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class AudioMediaSession extends JingleMediaSession {
|
||||||
*/
|
*/
|
||||||
public AudioMediaSession(final PayloadType payloadType, final TransportCandidate remote,
|
public AudioMediaSession(final PayloadType payloadType, final TransportCandidate remote,
|
||||||
final TransportCandidate local, String locator, JingleSession jingleSession) {
|
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();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ public class AudioMediaSession extends JingleMediaSession {
|
||||||
remotePort = this.getRemote().getPort();
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class SpeexMediaManager extends JingleMediaManager {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public JingleMediaSession createMediaSession(PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, final JingleSession jingleSession) {
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -390,7 +390,7 @@ public class Workgroup {
|
||||||
* @throws SmackException
|
* @throws SmackException
|
||||||
* @throws InterruptedException
|
* @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 already in the queue ignore the join request.
|
||||||
if (inQueue) {
|
if (inQueue) {
|
||||||
throw new IllegalStateException("Already in queue " + workgroupJID);
|
throw new IllegalStateException("Already in queue " + workgroupJID);
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class MetaDataUtils {
|
||||||
/**
|
/**
|
||||||
* Serializes a Map of String name/value pairs into the meta-data XML format.
|
* Serializes a Map of String name/value pairs into the meta-data XML format.
|
||||||
*
|
*
|
||||||
* @param metaData the Map of meta-data as Map<String,List<String>>
|
* @param metaData the Map of meta-data as Map<String, List<String>>
|
||||||
* @return the meta-data values in XML form.
|
* @return the meta-data values in XML form.
|
||||||
*/
|
*/
|
||||||
public static String serializeMetaData(Map<String, List<String>> metaData) {
|
public static String serializeMetaData(Map<String, List<String>> metaData) {
|
||||||
|
|
|
@ -98,7 +98,7 @@ public final class OmemoManager extends Manager {
|
||||||
private static final Integer UNKNOWN_DEVICE_ID = -1;
|
private static final Integer UNKNOWN_DEVICE_ID = -1;
|
||||||
final Object LOCK = new Object();
|
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 OmemoService<?, ?, ?, ?, ?, ?, ?, ?, ?> service;
|
||||||
|
|
||||||
private final HashSet<OmemoMessageListener> omemoMessageListeners = new HashSet<>();
|
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.");
|
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) {
|
if (managersOfConnection == null) {
|
||||||
managersOfConnection = new TreeMap<>();
|
managersOfConnection = new TreeMap<>();
|
||||||
INSTANCES.put(connection, managersOfConnection);
|
INSTANCES.put(connection, managersOfConnection);
|
||||||
|
@ -938,7 +938,7 @@ public final class OmemoManager extends Manager {
|
||||||
*
|
*
|
||||||
* @return omemoService
|
* @return omemoService
|
||||||
*/
|
*/
|
||||||
OmemoService<?,?,?,?,?,?,?,?,?> getOmemoService() {
|
OmemoService<?, ?, ?, ?, ?, ?, ?, ?, ?> getOmemoService() {
|
||||||
throwIfNoServiceSet();
|
throwIfNoServiceSet();
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ public abstract class OmemoRatchet<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,
|
||||||
// copy key part into messageKey
|
// copy key part into messageKey
|
||||||
System.arraycopy(unpackedKey, 0, messageKey, 0, 16);
|
System.arraycopy(unpackedKey, 0, messageKey, 0, 16);
|
||||||
// copy tag part into authTag
|
// 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) {
|
} else if (element.isKeyTransportElement() && unpackedKey.length == 16) {
|
||||||
messageKey = unpackedKey;
|
messageKey = unpackedKey;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -123,7 +123,7 @@ extends SmackTestSuite {
|
||||||
int high = Integer.MAX_VALUE - 2;
|
int high = Integer.MAX_VALUE - 2;
|
||||||
int max = Integer.MAX_VALUE;
|
int max = Integer.MAX_VALUE;
|
||||||
assertEquals(OmemoKeyUtil.addInBounds(high, 3), 1);
|
assertEquals(OmemoKeyUtil.addInBounds(high, 3), 1);
|
||||||
assertEquals(OmemoKeyUtil.addInBounds(1,2), 3);
|
assertEquals(OmemoKeyUtil.addInBounds(1, 2), 3);
|
||||||
assertEquals(OmemoKeyUtil.addInBounds(max, 5), 5);
|
assertEquals(OmemoKeyUtil.addInBounds(max, 5), 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,8 +269,8 @@ public abstract class OmemoStoreTest<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadStoreCachedDeviceList() throws IOException {
|
public void loadStoreCachedDeviceList() throws IOException {
|
||||||
Integer[] active = new Integer[] {1,5,999,10};
|
Integer[] active = new Integer[] {1, 5, 999, 10};
|
||||||
Integer[] inactive = new Integer[] {6,7,8};
|
Integer[] inactive = new Integer[] {6, 7, 8};
|
||||||
OmemoCachedDeviceList before = new OmemoCachedDeviceList(
|
OmemoCachedDeviceList before = new OmemoCachedDeviceList(
|
||||||
new HashSet<>(Arrays.asList(active)),
|
new HashSet<>(Arrays.asList(active)),
|
||||||
new HashSet<>(Arrays.asList(inactive)));
|
new HashSet<>(Arrays.asList(inactive)));
|
||||||
|
|
|
@ -113,7 +113,7 @@ public abstract class OpenPgpContentElement implements ExtensionElement {
|
||||||
/**
|
/**
|
||||||
* Returns the first extension of this stanza that has the given namespace.
|
* Returns the first extension of this stanza that has the given namespace.
|
||||||
* <p>
|
* <p>
|
||||||
* When possible, use {@link #getExtension(String,String)} instead.
|
* When possible, use {@link #getExtension(String, String)} instead.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param namespace the namespace of the extension that is desired.
|
* @param namespace the namespace of the extension that is desired.
|
||||||
|
|
|
@ -30,8 +30,8 @@ public class SASLGSSAPIMechanism extends SASLJavaXMechanism {
|
||||||
public static final String NAME = GSSAPI;
|
public static final String NAME = GSSAPI;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.setProperty("javax.security.auth.useSubjectCredsOnly","false");
|
System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
|
||||||
System.setProperty("java.security.auth.login.config","gss.conf");
|
System.setProperty("java.security.auth.login.config", "gss.conf");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,7 +47,7 @@ public class SASLGSSAPIMechanism extends SASLJavaXMechanism {
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> getSaslProps() {
|
protected Map<String, String> getSaslProps() {
|
||||||
Map<String, String> props = super.getSaslProps();
|
Map<String, String> props = super.getSaslProps();
|
||||||
props.put(Sasl.SERVER_AUTH,"TRUE");
|
props.put(Sasl.SERVER_AUTH, "TRUE");
|
||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ public abstract class SASLJavaXMechanism extends SASLMechanism {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Map<String,String> getSaslProps() {
|
protected Map<String, String> getSaslProps() {
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue