Merge branch 'protocol-state-exception' into 'master'

ProtocolStateException for client protocols

Methods that implement local actions in a client protocol (for example, accepting an invitation) can throw this exception to indicate that the action wasn't taken because the action isn't applicable to the current state. This can happen if the protocol state machine is updated by an incoming message and the user takes an action before the UI has been updated.

See merge request !368
This commit is contained in:
akwizgran
2016-10-27 15:46:03 +00:00
9 changed files with 16 additions and 11 deletions

View File

@@ -0,0 +1,11 @@
package org.briarproject.api.clients;
import org.briarproject.api.db.DbException;
/**
* Thrown when a database operation is attempted as part of a protocol session
* and the operation is not applicable to the current protocol state.
*/
public class ProtocolStateException extends DbException {
}

View File

@@ -6,5 +6,4 @@ package org.briarproject.api.db;
*/
public class ContactExistsException extends DbException {
private static final long serialVersionUID = -6658762011691502411L;
}

View File

@@ -1,7 +1,8 @@
package org.briarproject.api.db;
/** Thrown when a database operation is attempted and the database is closed. */
/**
* Thrown when a database operation is attempted and the database is closed.
*/
public class DbClosedException extends DbException {
private static final long serialVersionUID = -3679248177625310653L;
}

View File

@@ -2,9 +2,8 @@ package org.briarproject.api.db;
public class DbException extends Exception {
private static final long serialVersionUID = 3706581789209939441L;
public DbException() {}
public DbException() {
}
public DbException(Throwable t) {
super(t);

View File

@@ -7,5 +7,4 @@ package org.briarproject.api.db;
*/
public class NoSuchContactException extends DbException {
private static final long serialVersionUID = -7048538231308207386L;
}

View File

@@ -7,5 +7,4 @@ package org.briarproject.api.db;
*/
public class NoSuchGroupException extends DbException {
private static final long serialVersionUID = -5494178507342571697L;
}

View File

@@ -7,5 +7,4 @@ package org.briarproject.api.db;
*/
public class NoSuchLocalAuthorException extends DbException {
private static final long serialVersionUID = 494398665376703860L;
}

View File

@@ -7,5 +7,4 @@ package org.briarproject.api.db;
*/
public class NoSuchMessageException extends DbException {
private static final long serialVersionUID = 9191508339698803848L;
}

View File

@@ -7,5 +7,4 @@ package org.briarproject.api.db;
*/
public class NoSuchTransportException extends DbException {
private static final long serialVersionUID = -6274982612759573100L;
}