Skip to content

Commit 0732c49

Browse files
committed
issue #745 : Fix another instance in RDFJSONParser
Signed-off-by: Peter Ansell <p_ansell@yahoo.com>
1 parent 01c6c32 commit 0732c49

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

core/rio/rdfjson/src/main/java/org/eclipse/rdf4j/rio/rdfjson/RDFJSONParser.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void parse(final InputStream inputStream, final String baseUri)
7272
JsonParser jp = null;
7373

7474
clear();
75-
75+
7676
try {
7777
if (this.rdfHandler != null) {
7878
this.rdfHandler.startRDF();
@@ -156,12 +156,15 @@ protected void reportFatalError(String msg, JsonLocation location)
156156
public void parse(final Reader reader, final String baseUri)
157157
throws IOException, RDFParseException, RDFHandlerException
158158
{
159-
if (rdfHandler != null) {
160-
rdfHandler.startRDF();
161-
}
162159
JsonParser jp = null;
163160

161+
clear();
162+
164163
try {
164+
if (this.rdfHandler != null) {
165+
this.rdfHandler.startRDF();
166+
}
167+
165168
jp = RDFJSONUtility.JSON_FACTORY.createParser(reader);
166169
rdfJsonToHandlerInternal(rdfHandler, valueFactory, jp);
167170
}
@@ -174,6 +177,7 @@ public void parse(final Reader reader, final String baseUri)
174177
}
175178
}
176179
finally {
180+
clear();
177181
if (jp != null) {
178182
try {
179183
jp.close();
@@ -356,11 +360,11 @@ else if (RDFJSONUtility.URI.equals(nextType)) {
356360
if (!nextContexts.isEmpty()) {
357361
for (final String nextContext : nextContexts) {
358362
final Resource context;
359-
360-
if(nextContext.equals(RDFJSONUtility.NULL)) {
363+
364+
if (nextContext.equals(RDFJSONUtility.NULL)) {
361365
context = null;
362366
}
363-
else if(nextContext.startsWith("_:")) {
367+
else if (nextContext.startsWith("_:")) {
364368
context = createBNode(nextContext.substring(2));
365369
}
366370
else {

0 commit comments

Comments
 (0)