Permalink
Browse files

incorporated fix for issues noted by Jens here:

  • Loading branch information...
mschoch committed Mar 28, 2012
1 parent 1b6a963 commit 42b5ee68c69806f5dc4540ff1a4e7b5586977788
Showing with 6 additions and 4 deletions.
  1. +6 −4 TouchDB-Android/src/com/couchbase/touchdb/TDDatabase.java
@@ -672,8 +672,11 @@ public TDRevision getDocumentWithIDAndRev(String id, String rev, EnumSet<TDConte
boolean deleted = (cursor.getInt(1) > 0);
result = new TDRevision(id, rev, deleted);
result.setSequence(cursor.getLong(2));
- if(!contentOptions.contains(TDContentOptions.TDNoBody)) {
- byte[] json = cursor.getBlob(3);
+ if(!contentOptions.equals(EnumSet.of(TDContentOptions.TDNoBody))) {
+ byte[] json = null;
+ if(!contentOptions.contains(TDContentOptions.TDNoBody)) {
+ json = cursor.getBlob(3);
+ }
expandStoredJSONIntoRevisionWithAttachments(json, result, contentOptions);
}
}
@@ -688,8 +691,7 @@ public TDRevision getDocumentWithIDAndRev(String id, String rev, EnumSet<TDConte
}
public boolean existsDocumentWithIDAndRev(String docId, String revId) {
- //OPT: Do this without loading the data
- return getDocumentWithIDAndRev(docId, revId, EnumSet.noneOf(TDContentOptions.class)) != null;
+ return getDocumentWithIDAndRev(docId, revId, EnumSet.of(TDContentOptions.TDNoBody)) != null;
}
public TDStatus loadRevisionBody(TDRevision rev, EnumSet<TDContentOptions> contentOptions) {

0 comments on commit 42b5ee6

Please sign in to comment.