Skip to content

Commit 24a8d36

Browse files
authored
Revert "Possible fix for #168 - Always create new instance of col"
1 parent 42a3e08 commit 24a8d36

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/jsoniter/ReflectionCollectionDecoder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ private Object decode_(JsonIterator iter) throws Exception {
3838
if (iter.readNull()) {
3939
return null;
4040
}
41-
col = (Collection) this.ctor.newInstance();
41+
if (col == null) {
42+
col = (Collection) this.ctor.newInstance();
43+
} else {
44+
col.clear();
45+
}
4246
while (iter.readArray()) {
4347
col.add(compTypeDecoder.decode(iter));
4448
}

0 commit comments

Comments
 (0)