mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-16 17:22:06 +01:00
Compare commits
10 commits
9de2b983c8
...
eecd5b70d3
Author | SHA1 | Date | |
---|---|---|---|
|
eecd5b70d3 | ||
|
8da954f7a4 | ||
|
96e14471d0 | ||
|
d2f9617418 | ||
|
41a3ec05c7 | ||
|
b86d088926 | ||
|
4ca2c7cc69 | ||
|
2ac452fe1e | ||
|
95c73f51b1 | ||
|
fe85ab3b83 |
90 changed files with 204 additions and 163 deletions
|
@ -22,11 +22,12 @@ before_install:
|
||||||
- wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip
|
- wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-all.zip
|
||||||
- unzip -q gradle-${GRADLE_VERSION}-all.zip
|
- unzip -q gradle-${GRADLE_VERSION}-all.zip
|
||||||
- export PATH="$(pwd)/gradle-${GRADLE_VERSION}/bin:$PATH"
|
- export PATH="$(pwd)/gradle-${GRADLE_VERSION}/bin:$PATH"
|
||||||
- sudo apt-get install graphviz
|
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
update: true
|
update: true
|
||||||
|
packages:
|
||||||
|
- graphviz
|
||||||
|
|
||||||
install: gradle assemble --stacktrace
|
install: gradle assemble --stacktrace
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,7 @@ subprojects {
|
||||||
apply plugin: 'org.kordamp.gradle.clirr'
|
apply plugin: 'org.kordamp.gradle.clirr'
|
||||||
|
|
||||||
checkstyle {
|
checkstyle {
|
||||||
toolVersion = '8.10'
|
toolVersion = '8.22'
|
||||||
}
|
}
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
classifier = 'sources'
|
classifier = 'sources'
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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() + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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");
|
||||||
|
|
|
@ -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,
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 + ",";
|
||||||
}
|
}
|
||||||
|
|
|
@ -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++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class NumberUtil {
|
||||||
throw new IllegalArgumentException("unsigned 32-bit integers can't be negative");
|
throw new IllegalArgumentException("unsigned 32-bit integers can't be negative");
|
||||||
}
|
}
|
||||||
if (value > ((1L << 32) - 1)) {
|
if (value > ((1L << 32) - 1)) {
|
||||||
throw new IllegalArgumentException("unsigned 32-bit integers can't be greater then 2^32 - 1");
|
throw new IllegalArgumentException("unsigned 32-bit integers can't be greater than 2^32 - 1");
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright 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.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.jivesoftware.smack.util;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.security.Provider;
|
||||||
|
import java.security.Security;
|
||||||
|
|
||||||
|
import org.jxmpp.util.cache.LruCache;
|
||||||
|
|
||||||
|
public class SecurityUtil {
|
||||||
|
|
||||||
|
private static final LruCache<Class<? extends Provider>, Void> INSERTED_PROVIDERS_CACHE = new LruCache<>(8);
|
||||||
|
|
||||||
|
public static void ensureProviderAtFirstPosition(Class<? extends Provider> providerClass) {
|
||||||
|
if (INSERTED_PROVIDERS_CACHE.containsKey(providerClass)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Provider provider;
|
||||||
|
try {
|
||||||
|
provider = providerClass.getDeclaredConstructor().newInstance();
|
||||||
|
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
|
||||||
|
| NoSuchMethodException | SecurityException e) {
|
||||||
|
throw new IllegalArgumentException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
String providerName = provider.getName();
|
||||||
|
|
||||||
|
int installedPosition ;
|
||||||
|
synchronized (Security.class) {
|
||||||
|
Security.removeProvider(providerName);
|
||||||
|
installedPosition = Security.insertProviderAt(provider, 1);
|
||||||
|
}
|
||||||
|
assert installedPosition == 1;
|
||||||
|
|
||||||
|
INSERTED_PROVIDERS_CACHE.put(providerClass, null);
|
||||||
|
}
|
||||||
|
}
|
|
@ -110,7 +110,6 @@ public class StringUtils {
|
||||||
forAttribute,
|
forAttribute,
|
||||||
forAttributeApos,
|
forAttributeApos,
|
||||||
forText,
|
forText,
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -35,7 +35,6 @@ import static org.jivesoftware.smackx.hashes.HashManager.ALGORITHM.SHA_512;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.Security;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -43,7 +42,7 @@ import java.util.WeakHashMap;
|
||||||
|
|
||||||
import org.jivesoftware.smack.Manager;
|
import org.jivesoftware.smack.Manager;
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
import org.jivesoftware.smack.util.SecurityUtil;
|
||||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||||
import org.jivesoftware.smackx.hashes.element.HashElement;
|
import org.jivesoftware.smackx.hashes.element.HashElement;
|
||||||
|
|
||||||
|
@ -58,7 +57,9 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
public final class HashManager extends Manager {
|
public final class HashManager extends Manager {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Security.addProvider(new BouncyCastleProvider());
|
// Remove any BC providers and add a fresh one.
|
||||||
|
// This is done, since older Android versions ship with a crippled BC provider.
|
||||||
|
SecurityUtil.ensureProviderAtFirstPosition(BouncyCastleProvider.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String PREFIX_NS_ALGO = "urn:xmpp:hash-function-text-names:";
|
public static final String PREFIX_NS_ALGO = "urn:xmpp:hash-function-text-names:";
|
||||||
|
|
|
@ -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,
|
||||||
;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)) {
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -39,7 +39,6 @@ public class MamPrefsIQ extends IQ {
|
||||||
always,
|
always,
|
||||||
never,
|
never,
|
||||||
roster,
|
roster,
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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.
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,5 +19,4 @@ package org.jivesoftware.smackx.jingle;
|
||||||
public enum Role {
|
public enum Role {
|
||||||
initiator,
|
initiator,
|
||||||
responder,
|
responder,
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class MediaElement implements FormFieldChildElement {
|
||||||
xml.append(uris, xmlEnvironment);
|
xml.append(uris, xmlEnvironment);
|
||||||
|
|
||||||
xml.closeElement(this);
|
xml.closeElement(this);
|
||||||
return null;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MediaElement from(FormField formField) {
|
public MediaElement from(FormField formField) {
|
||||||
|
|
|
@ -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");
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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());
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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));
|
||||||
|
|
|
@ -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());
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>() {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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++) {
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()));
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
package org.jivesoftware.smackx.omemo;
|
package org.jivesoftware.smackx.omemo;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.UrlInitializer;
|
import org.jivesoftware.smack.initializer.UrlInitializer;
|
||||||
|
import org.jivesoftware.smack.util.SecurityUtil;
|
||||||
|
|
||||||
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializer class that registers omemo providers.
|
* Initializer class that registers omemo providers.
|
||||||
|
@ -26,6 +29,12 @@ import org.jivesoftware.smack.initializer.UrlInitializer;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class OmemoInitializer extends UrlInitializer {
|
public class OmemoInitializer extends UrlInitializer {
|
||||||
|
|
||||||
|
static {
|
||||||
|
// Remove any BC providers and add a fresh one.
|
||||||
|
// This is done, since older Android versions ship with a crippled BC provider.
|
||||||
|
SecurityUtil.ensureProviderAtFirstPosition(BouncyCastleProvider.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getProvidersUri() {
|
protected String getProvidersUri() {
|
||||||
return "classpath:org.jivesoftware.smackx.omemo/omemo.providers";
|
return "classpath:org.jivesoftware.smackx.omemo/omemo.providers";
|
||||||
|
|
|
@ -22,7 +22,6 @@ import static org.jivesoftware.smackx.omemo.util.OmemoConstants.Crypto.KEYTYPE;
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.Security;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -45,7 +44,6 @@ import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.packet.Message;
|
import org.jivesoftware.smack.packet.Message;
|
||||||
import org.jivesoftware.smack.packet.Stanza;
|
import org.jivesoftware.smack.packet.Stanza;
|
||||||
import org.jivesoftware.smack.packet.StanzaError;
|
import org.jivesoftware.smack.packet.StanzaError;
|
||||||
|
|
||||||
import org.jivesoftware.smackx.carbons.packet.CarbonExtension;
|
import org.jivesoftware.smackx.carbons.packet.CarbonExtension;
|
||||||
import org.jivesoftware.smackx.mam.MamManager;
|
import org.jivesoftware.smackx.mam.MamManager;
|
||||||
import org.jivesoftware.smackx.muc.MultiUserChat;
|
import org.jivesoftware.smackx.muc.MultiUserChat;
|
||||||
|
@ -80,7 +78,6 @@ import org.jivesoftware.smackx.pubsub.PayloadItem;
|
||||||
import org.jivesoftware.smackx.pubsub.PubSubException;
|
import org.jivesoftware.smackx.pubsub.PubSubException;
|
||||||
import org.jivesoftware.smackx.pubsub.PubSubManager;
|
import org.jivesoftware.smackx.pubsub.PubSubManager;
|
||||||
|
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|
||||||
import org.jxmpp.jid.BareJid;
|
import org.jxmpp.jid.BareJid;
|
||||||
import org.jxmpp.jid.EntityBareJid;
|
import org.jxmpp.jid.EntityBareJid;
|
||||||
import org.jxmpp.jid.Jid;
|
import org.jxmpp.jid.Jid;
|
||||||
|
@ -102,10 +99,6 @@ import org.jxmpp.jid.Jid;
|
||||||
public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
|
public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey, T_Sess, T_Addr, T_ECPub, T_Bundle, T_Ciph>
|
||||||
implements OmemoCarbonCopyStanzaReceivedListener, OmemoMessageStanzaReceivedListener {
|
implements OmemoCarbonCopyStanzaReceivedListener, OmemoMessageStanzaReceivedListener {
|
||||||
|
|
||||||
static {
|
|
||||||
Security.addProvider(new BouncyCastleProvider());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected static final Logger LOGGER = Logger.getLogger(OmemoService.class.getName());
|
protected static final Logger LOGGER = Logger.getLogger(OmemoService.class.getName());
|
||||||
|
|
||||||
private static final long MILLIS_PER_HOUR = 1000L * 60 * 60;
|
private static final long MILLIS_PER_HOUR = 1000L * 60 * 60;
|
||||||
|
|
|
@ -25,21 +25,20 @@ import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.Security;
|
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.test.util.SmackTestSuite;
|
||||||
import org.jivesoftware.smackx.omemo.element.OmemoElement;
|
import org.jivesoftware.smackx.omemo.element.OmemoElement;
|
||||||
import org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException;
|
import org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException;
|
||||||
import org.jivesoftware.smackx.omemo.internal.CipherAndAuthTag;
|
import org.jivesoftware.smackx.omemo.internal.CipherAndAuthTag;
|
||||||
import org.jivesoftware.smackx.omemo.internal.CiphertextTuple;
|
import org.jivesoftware.smackx.omemo.internal.CiphertextTuple;
|
||||||
import org.jivesoftware.smackx.omemo.util.OmemoMessageBuilder;
|
import org.jivesoftware.smackx.omemo.util.OmemoMessageBuilder;
|
||||||
|
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the identityKeyWrapper.
|
* Test the identityKeyWrapper.
|
||||||
*/
|
*/
|
||||||
public class WrapperObjectsTest {
|
public class WrapperObjectsTest extends SmackTestSuite {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void ciphertextTupleTest() {
|
public void ciphertextTupleTest() {
|
||||||
|
@ -56,7 +55,6 @@ public class WrapperObjectsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void cipherAndAuthTagTest() throws NoSuchAlgorithmException, CryptoFailedException {
|
public void cipherAndAuthTagTest() throws NoSuchAlgorithmException, CryptoFailedException {
|
||||||
Security.addProvider(new BouncyCastleProvider());
|
|
||||||
byte[] key = OmemoMessageBuilder.generateKey(KEYTYPE, KEYLENGTH);
|
byte[] key = OmemoMessageBuilder.generateKey(KEYTYPE, KEYLENGTH);
|
||||||
byte[] iv = OmemoMessageBuilder.generateIv();
|
byte[] iv = OmemoMessageBuilder.generateIv();
|
||||||
byte[] authTag = OmemoMessageBuilder.generateIv();
|
byte[] authTag = OmemoMessageBuilder.generateIv();
|
||||||
|
|
|
@ -12,7 +12,7 @@ dependencies {
|
||||||
compile project(':smack-extensions')
|
compile project(':smack-extensions')
|
||||||
compile project(':smack-experimental')
|
compile project(':smack-experimental')
|
||||||
|
|
||||||
compile 'org.pgpainless:pgpainless-core:0.0.1-alpha4'
|
compile 'org.pgpainless:pgpainless-core:0.0.1-alpha7'
|
||||||
|
|
||||||
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
testCompile project(path: ":smack-core", configuration: "testRuntime")
|
||||||
testCompile project(path: ":smack-core", configuration: "archives")
|
testCompile project(path: ":smack-core", configuration: "archives")
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.jivesoftware.smackx.ox.crypto;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.security.Security;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -38,7 +37,6 @@ import org.jivesoftware.smackx.ox.element.SignElement;
|
||||||
import org.jivesoftware.smackx.ox.element.SigncryptElement;
|
import org.jivesoftware.smackx.ox.element.SigncryptElement;
|
||||||
import org.jivesoftware.smackx.ox.store.definition.OpenPgpStore;
|
import org.jivesoftware.smackx.ox.store.definition.OpenPgpStore;
|
||||||
|
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|
||||||
import org.bouncycastle.openpgp.PGPException;
|
import org.bouncycastle.openpgp.PGPException;
|
||||||
import org.bouncycastle.openpgp.PGPPublicKey;
|
import org.bouncycastle.openpgp.PGPPublicKey;
|
||||||
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
|
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
|
||||||
|
@ -53,13 +51,6 @@ public class PainlessOpenPgpProvider implements OpenPgpProvider {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(PainlessOpenPgpProvider.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(PainlessOpenPgpProvider.class.getName());
|
||||||
|
|
||||||
static {
|
|
||||||
// Remove any BC providers and add a fresh one.
|
|
||||||
// This is done, since older Android versions ship with a crippled BC provider.
|
|
||||||
Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
|
|
||||||
Security.addProvider(new BouncyCastleProvider());
|
|
||||||
}
|
|
||||||
|
|
||||||
private final XMPPConnection connection;
|
private final XMPPConnection connection;
|
||||||
private final OpenPgpStore store;
|
private final OpenPgpStore store;
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,21 @@
|
||||||
package org.jivesoftware.smackx.ox.util;
|
package org.jivesoftware.smackx.ox.util;
|
||||||
|
|
||||||
import org.jivesoftware.smack.initializer.UrlInitializer;
|
import org.jivesoftware.smack.initializer.UrlInitializer;
|
||||||
|
import org.jivesoftware.smack.util.SecurityUtil;
|
||||||
|
|
||||||
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializer class which registers ExtensionElementProviders on startup.
|
* Initializer class which registers ExtensionElementProviders on startup.
|
||||||
*/
|
*/
|
||||||
public class OpenPgpInitializer extends UrlInitializer {
|
public class OpenPgpInitializer extends UrlInitializer {
|
||||||
|
|
||||||
|
static {
|
||||||
|
// Remove any BC providers and add a fresh one.
|
||||||
|
// This is done, since older Android versions ship with a crippled BC provider.
|
||||||
|
SecurityUtil.ensureProviderAtFirstPosition(BouncyCastleProvider.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getProvidersUri() {
|
protected String getProvidersUri() {
|
||||||
return "classpath:org.jivesoftware.smackx.ox/openpgp.providers";
|
return "classpath:org.jivesoftware.smackx.ox/openpgp.providers";
|
||||||
|
|
|
@ -28,7 +28,6 @@ import java.io.IOException;
|
||||||
import java.security.InvalidAlgorithmParameterException;
|
import java.security.InvalidAlgorithmParameterException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.NoSuchProviderException;
|
import java.security.NoSuchProviderException;
|
||||||
import java.security.Security;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -45,7 +44,6 @@ import org.jivesoftware.smackx.ox.store.definition.OpenPgpStore;
|
||||||
import org.jivesoftware.smackx.ox.store.definition.OpenPgpTrustStore;
|
import org.jivesoftware.smackx.ox.store.definition.OpenPgpTrustStore;
|
||||||
import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore;
|
import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore;
|
||||||
|
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|
||||||
import org.bouncycastle.openpgp.PGPException;
|
import org.bouncycastle.openpgp.PGPException;
|
||||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
||||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||||
|
@ -81,7 +79,6 @@ public class OpenPgpStoreTest extends SmackTestSuite {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
storagePath = FileTestUtil.getTempDir("storeTest");
|
storagePath = FileTestUtil.getTempDir("storeTest");
|
||||||
Security.addProvider(new BouncyCastleProvider());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parameterized.Parameters
|
@Parameterized.Parameters
|
||||||
|
|
|
@ -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)) {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ allprojects {
|
||||||
// - https://issues.igniterealtime.org/browse/SMACK-858
|
// - https://issues.igniterealtime.org/browse/SMACK-858
|
||||||
jxmppVersion = '0.7.0-alpha5'
|
jxmppVersion = '0.7.0-alpha5'
|
||||||
miniDnsVersion = '0.4.0-alpha3'
|
miniDnsVersion = '0.4.0-alpha3'
|
||||||
bouncyCastleVersion = '1.61'
|
bouncyCastleVersion = '1.62'
|
||||||
smackMinAndroidSdk = 19
|
smackMinAndroidSdk = 19
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue