Permalink
Browse files

safely handle when workload database does not exist

  • Loading branch information...
1 parent cd7afb1 commit 950e66d5933c1af47e26885a0e73dddc3e262b57 @mschoch mschoch committed Dec 12, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/com/couchbase/androidtester/CouchbaseAndroidTesterActivity.java
@@ -8,6 +8,7 @@
import org.ektorp.CouchDbConnector;
import org.ektorp.CouchDbInstance;
import org.ektorp.DbAccessException;
+import org.ektorp.DocumentNotFoundException;
import org.ektorp.ReplicationCommand;
import org.ektorp.android.http.AndroidHttpClient;
import org.ektorp.android.util.EktorpAsyncTask;
@@ -222,7 +223,12 @@ public void couchbaseStarted(String host, int port) {
@Override
protected void doInBackground() {
- couchDbInstance.deleteDatabase(DEFAULT_WORKLOAD_DB);
+ try {
+ couchDbInstance.deleteDatabase(DEFAULT_WORKLOAD_DB);
+ }
+ catch(DocumentNotFoundException ignore) {
+ //ignore if database does not exist
+ }
workloadConnector = couchDbInstance.createConnector(DEFAULT_WORKLOAD_DB, true);
reportConnector = couchDbInstance.createConnector(DEFAULT_REPORT_DB, true);
}

0 comments on commit 950e66d

Please sign in to comment.