Skip to content

Commit 1498c25

Browse files
author
mpv1989
committed
Fix inconsistency of getDocument() variants (Issue #168)
1 parent e497171 commit 1498c25

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

β€ŽChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
v4.3.3 (2018-xx-xx)
22
---------------------------
33
* added AqlQueryOptions.memoryLimit(Long)
4+
* fixed inconsistency of getDocument() variants (Issue #168)
45

56
v4.3.2 (2017-11-30)
67
---------------------------

β€Žsrc/main/java/com/arangodb/ArangoCollection.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,7 @@ public DocumentImportEntity importDocuments(final String values, final DocumentI
208208
* @throws ArangoDBException
209209
*/
210210
public <T> T getDocument(final String key, final Class<T> type) throws ArangoDBException {
211-
executor.validateDocumentKey(key);
212-
try {
213-
return executor.execute(getDocumentRequest(key, new DocumentReadOptions()), type);
214-
} catch (final ArangoDBException e) {
215-
if (LOGGER.isDebugEnabled()) {
216-
LOGGER.debug(e.getMessage(), e);
217-
}
218-
return null;
219-
}
211+
return getDocument(key, type, new DocumentReadOptions());
220212
}
221213

222214
/**

β€Žsrc/test/java/com/arangodb/ArangoCollectionTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,19 @@ public void getDocumentNotFound() {
224224
assertThat(document, is(nullValue()));
225225
}
226226

227+
@Test
228+
public void getDocumentNotFoundOptionsDefault() {
229+
final BaseDocument document = db.collection(COLLECTION_NAME).getDocument("no", BaseDocument.class,
230+
new DocumentReadOptions());
231+
assertThat(document, is(nullValue()));
232+
}
233+
234+
@Test
235+
public void getDocumentNotFoundOptionsNull() {
236+
final BaseDocument document = db.collection(COLLECTION_NAME).getDocument("no", BaseDocument.class, null);
237+
assertThat(document, is(nullValue()));
238+
}
239+
227240
@Test(expected = ArangoDBException.class)
228241
public void getDocumentNotFoundThrowException() {
229242
db.collection(COLLECTION_NAME).getDocument("no", BaseDocument.class,

0 commit comments

Comments
 (0)