Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: java
jdk:
- openjdk8
script: mvn -f json-overlay/pom.xml test
cache:
directories:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ private ListOverlay(JsonNode json, JsonOverlay<?> parent, OverlayFactory<List<V>

private ListOverlay(List<V> value, JsonOverlay<?> parent, OverlayFactory<List<V>> factory,
ReferenceManager refMgr) {
super(new ArrayList<>(value), parent, factory, refMgr);
super(copyValue(value), parent, factory, refMgr);
this.itemFactory = ((ListOverlayFactory<V>) factory).getItemFactory();
}
static <T> List<T> copyValue(List<T> src) {
if (src == null)
return null;
return new ArrayList<>(src);
}

@Override
protected JsonOverlay<?> _findInternal(JsonPointer path) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,19 @@ private MapOverlay(JsonNode json, JsonOverlay<?> parent, OverlayFactory<Map<Stri

private MapOverlay(Map<String, V> value, JsonOverlay<?> parent, OverlayFactory<Map<String, V>> factory,
ReferenceManager refMgr) {
super(new LinkedHashMap<>(value), parent, factory, refMgr);
super(copyValue(value), parent, factory, refMgr);
MapOverlayFactory<V> mapOverlayFactory = (MapOverlayFactory<V>) factory;
this.valueFactory = mapOverlayFactory.getValueFactory();
String keyPattern = mapOverlayFactory.getKeyPattern();
this.keyPattern = keyPattern != null ? Pattern.compile(keyPattern) : null;
}

static <T> Map<String, T> copyValue(Map<String, T> src) {
if (src == null)
return null;
return new LinkedHashMap<>(src);
}

@Override
protected JsonOverlay<?> _findInternal(JsonPointer path) {
String key = path.getMatchingProperty();
Expand Down