Commit 85d2af23 authored by Daniel Gerhardt's avatar Daniel Gerhardt

Catch DocumentNotFoundException on design doc creation

parent 136134c1
......@@ -2,6 +2,7 @@ package de.thm.arsnova.persistance.couchdb;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.ektorp.CouchDbInstance;
import org.ektorp.DocumentNotFoundException;
import org.ektorp.impl.ObjectMapperFactory;
import org.ektorp.impl.StdCouchDbConnector;
import org.slf4j.Logger;
......@@ -62,12 +63,12 @@ public class InitializingCouchDbConnector extends StdCouchDbConnector implements
logger.warn("Failed to serialize design doc.", e);
}
}
String rev = getCurrentRevision((String) doc.get("_id"));
if (rev == null) {
create(doc);
} else {
try {
String rev = getCurrentRevision((String) doc.get("_id"));
doc.put("_rev", rev);
update(doc);
} catch (DocumentNotFoundException e) {
create(doc);
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment