Skip to content

Commit 07169ca

Browse files
author
a-brandt
committed
fixed simple/range
1 parent b0acfdf commit 07169ca

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/main/java/com/arangodb/impl/InternalDocumentDriverImpl.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.List;
2020
import java.util.ListIterator;
2121
import java.util.Locale;
22+
import java.util.Map;
2223
import java.util.regex.Matcher;
2324
import java.util.regex.Pattern;
2425

@@ -126,10 +127,15 @@ public <T> DocumentEntity<T> replaceDocument(
126127
Boolean waitForSync) throws ArangoException {
127128

128129
validateDocumentHandle(documentHandle);
129-
HttpResponseEntity res = httpManager.doPut(
130-
createDocumentEndpointUrl(database, documentHandle), new MapBuilder().put("rev", rev)
131-
.put(POLICY, policy == null ? null : policy.name()).put(WAIT_FOR_SYNC, waitForSync).get(),
132-
EntityFactory.toJsonString(value));
130+
131+
Map<String, Object> header = null;
132+
if (rev != null) {
133+
MapBuilder mapBuilder = new MapBuilder().put("If-Match", rev);
134+
header = mapBuilder.get();
135+
}
136+
137+
HttpResponseEntity res = httpManager.doPut(createDocumentEndpointUrl(database, documentHandle), header,
138+
new MapBuilder().put(WAIT_FOR_SYNC, waitForSync).get(), EntityFactory.toJsonString(value));
133139

134140
DocumentEntity<T> result = createEntity(res, DocumentEntity.class);
135141
annotationHandler.updateDocumentRev(value, result.getDocumentRevision());

0 commit comments

Comments
 (0)