DatabaseComponent throws an exception instead of returning silently if a contact is removed during an operation involving that contact. More unit tests.

This commit is contained in:
akwizgran
2011-07-05 18:15:44 +01:00
parent 13b3d4cc03
commit 5d768a5718
14 changed files with 282 additions and 134 deletions

View File

@@ -21,7 +21,6 @@ public interface DatabaseComponent {
static final long MAX_BYTES_BETWEEN_SPACE_CHECKS = 5L * MEGABYTES;
static final long MAX_MS_BETWEEN_SPACE_CHECKS = 60L * 1000L; // 1 min
static final long BYTES_PER_SWEEP = 5L * MEGABYTES;
static final int RETRANSMIT_THRESHOLD = 3;
/**
* Opens the database.

View File

@@ -4,6 +4,10 @@ public class DbException extends Exception {
private static final long serialVersionUID = 3706581789209939441L;
public DbException() {
super();
}
public DbException(Throwable t) {
super(t);
}

View File

@@ -0,0 +1,14 @@
package net.sf.briar.api.db;
/**
* Thrown when a database operation is attempted for a contact that is not in
* the database.
*/
public class NoSuchContactException extends DbException {
private static final long serialVersionUID = -7048538231308207386L;
public NoSuchContactException() {
super();
}
}