Skip to content

Commit

Permalink
fixes #1331: Mongo procedure throws NullPointerException if a field i…
Browse files Browse the repository at this point in the history
…s null (#1332)
  • Loading branch information
conker84 authored and sarmbruster committed Nov 13, 2019
1 parent 5fb075e commit b2889bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/apoc/mongodb/MongoDBColl.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public Object convertAndExtract(Object data) {
}
return new AbstractMap.SimpleEntry(e.getKey(), value);
})
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
.collect(HashMap::new, (m, e)-> m.put(e.getKey(), e.getValue()), HashMap::putAll); // please look at https://bugs.openjdk.java.net/browse/JDK-8148463
}
if (data instanceof Collection) {
Collection<Object> collection = (Collection<Object>) data;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/apoc/mongodb/MongoDBTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static void setUp() throws Exception {
productCollection.deleteMany(new Document());
LongStream.range(0, NUM_OF_RECORDS)
.forEach(i -> testCollection.insertOne(new Document(map("name", "testDocument",
"date", currentTime, "longValue", longValue))));
"date", currentTime, "longValue", longValue, "nullField", null))));

productCollection.insertOne(new Document(map("name", "My Awesome Product",
"price", 800,
Expand Down

0 comments on commit b2889bd

Please sign in to comment.