Skip to content

Commit 2e7f848

Browse files
committed
Fixed memory leak
Fixes #27
1 parent 20d277a commit 2e7f848

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main/java/mjson/Json.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ public static Schema schema(Json S, URI uri)
11251125

11261126
public static class DefaultFactory implements Factory
11271127
{
1128-
public Json nil() { return Json.topnull; }
1128+
public Json nil() { return new NullJson(); }
11291129
public Json bool(boolean x) { return new BooleanJson(x ? Boolean.TRUE : Boolean.FALSE, null); }
11301130
public Json string(String x) { return new StringJson(x, null); }
11311131
public Json number(Number x) { return new NumberJson(x, null); }
@@ -1134,7 +1134,7 @@ public static class DefaultFactory implements Factory
11341134
public Json make(Object anything)
11351135
{
11361136
if (anything == null)
1137-
return topnull;
1137+
return nil();
11381138
else if (anything instanceof Json)
11391139
return (Json)anything;
11401140
else if (anything instanceof String)
@@ -1913,8 +1913,6 @@ public Json next() {
19131913

19141914
}
19151915

1916-
static NullJson topnull = new NullJson();
1917-
19181916
/**
19191917
* <p>
19201918
* Set the parent (i.e. enclosing element) of Json element.

0 commit comments

Comments
 (0)