diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java b/smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java index 4c754cd92..afd17303d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/SynchronizationPoint.java @@ -68,9 +68,9 @@ public class SynchronizationPoint { * @param request the plain stream element to send. * @throws NoResponseException if no response was received. * @throws NotConnectedException if the connection is not connected. - * @return true if synchronization point was successful, false on failure. + * @return null if synchronization point was successful, or the failure Exception. */ - public boolean sendAndWaitForResponse(TopLevelStreamElement request) throws NoResponseException, + public E sendAndWaitForResponse(TopLevelStreamElement request) throws NoResponseException, NotConnectedException, InterruptedException { assert (state == State.Initial); connectionLock.lock(); @@ -133,17 +133,17 @@ public class SynchronizationPoint { * Check if this synchronization point is successful or wait the connections reply timeout. * @throws NoResponseException if there was no response marking the synchronization point as success or failed. * @throws InterruptedException - * @return true if synchronization point was successful, false on failure. + * @return null if synchronization point was successful, or the failure Exception. */ - public boolean checkIfSuccessOrWait() throws NoResponseException, InterruptedException { + public E checkIfSuccessOrWait() throws NoResponseException, InterruptedException { connectionLock.lock(); try { switch (state) { // Return immediately on success or failure case Success: - return true; + return null; case Failure: - return false; + return failureException; default: // Do nothing break; @@ -249,18 +249,19 @@ public class SynchronizationPoint { *

* The exception is thrown, if state is one of 'Initial', 'NoResponse' or 'RequestSent' *

+ * @return true if synchronization point was successful, false on failure. * @throws NoResponseException */ - private boolean checkForResponse() throws NoResponseException { + private E checkForResponse() throws NoResponseException { switch (state) { case Initial: case NoResponse: case RequestSent: throw NoResponseException.newWith(connection, waitFor); case Success: - return true; + return null; case Failure: - return false; + return failureException; default: throw new AssertionError("Unknown state " + state); }