Skip to content

Commit 43e466d

Browse files
committed
GH-5744: Final polishing and migration of deprecated code
1 parent 1a7765d commit 43e466d

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import tools.jackson.core.JacksonException;
3636
import tools.jackson.core.JsonParser;
3737
import tools.jackson.core.JsonToken;
38+
import tools.jackson.core.ObjectReadContext;
3839
import tools.jackson.core.StreamReadFeature;
3940
import tools.jackson.core.StreamWriteFeature;
4041
import tools.jackson.core.TokenStreamFactory;
@@ -84,11 +85,11 @@ public void parse(final InputStream inputStream, final String baseUri)
8485
this.rdfHandler.startRDF();
8586
}
8687

87-
jp = configureNewJsonFactory().createParser(inputStream);
88+
jp = configureNewJsonFactory().createParser(ObjectReadContext.empty(), inputStream);
8889
rdfJsonToHandlerInternal(this.rdfHandler, this.valueFactory, jp);
8990
} catch (JacksonException e) {
9091
if (jp != null) {
91-
reportFatalError("Found IOException during parsing", e, jp.currentLocation());
92+
reportFatalError("Found exception during parsing", e, jp.currentLocation());
9293
} else {
9394
reportFatalError(e);
9495
}
@@ -154,11 +155,11 @@ public void parse(final Reader reader, final String baseUri)
154155
this.rdfHandler.startRDF();
155156
}
156157

157-
jp = configureNewJsonFactory().createParser(reader);
158+
jp = configureNewJsonFactory().createParser(ObjectReadContext.empty(), reader);
158159
rdfJsonToHandlerInternal(rdfHandler, valueFactory, jp);
159160
} catch (JacksonException e) {
160161
if (jp != null) {
161-
reportFatalError("Found IOException during parsing", e, jp.currentLocation());
162+
reportFatalError("Found exception during parsing", e, jp.currentLocation());
162163
} else {
163164
reportFatalError(e);
164165
}
@@ -229,7 +230,7 @@ private void rdfJsonToHandlerInternal(final RDFHandler handler, final ValueFacto
229230

230231
jp.nextToken();
231232

232-
nextValue = jp.getText();
233+
nextValue = jp.getString();
233234
} else if (RDFJSONUtility.TYPE.equals(fieldName)) {
234235
if (nextType != null) {
235236
reportError(
@@ -240,7 +241,7 @@ private void rdfJsonToHandlerInternal(final RDFHandler handler, final ValueFacto
240241

241242
jp.nextToken();
242243

243-
nextType = jp.getText();
244+
nextType = jp.getString();
244245
} else if (RDFJSONUtility.LANG.equals(fieldName)) {
245246
if (nextLanguage != null) {
246247
reportError(
@@ -252,7 +253,7 @@ private void rdfJsonToHandlerInternal(final RDFHandler handler, final ValueFacto
252253

253254
jp.nextToken();
254255

255-
nextLanguage = jp.getText();
256+
nextLanguage = jp.getString();
256257
} else if (RDFJSONUtility.DATATYPE.equals(fieldName)) {
257258
if (nextDatatype != null) {
258259
reportError(
@@ -264,15 +265,15 @@ private void rdfJsonToHandlerInternal(final RDFHandler handler, final ValueFacto
264265

265266
jp.nextToken();
266267

267-
nextDatatype = jp.getText();
268+
nextDatatype = jp.getString();
268269
} else if (RDFJSONUtility.GRAPHS.equals(fieldName)) {
269270
if (jp.nextToken() != JsonToken.START_ARRAY) {
270271
reportError("Expected graphs to start with an array", jp.currentLocation(),
271272
RDFJSONParserSettings.SUPPORT_GRAPHS_EXTENSION);
272273
}
273274

274275
while (jp.nextToken() != JsonToken.END_ARRAY) {
275-
final String nextGraph = jp.getText();
276+
final String nextGraph = jp.getString();
276277
nextContexts.add(nextGraph);
277278
}
278279
} else {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ public void consumeStatement(final Statement statement) throws RDFHandlerExcepti
184184
* @param object The RDF value to serialise
185185
* @param contexts The set of contexts that are relevant to this object, including null contexts as they are found.
186186
* @param jg the {@link JsonGenerator} to write to.
187-
* @throws IOException
188-
* @throws JsonGenerationException
187+
* @throws JacksonException
189188
*/
190189
protected static void writeObject(final Value object, final Set<Resource> contexts, final JsonGenerator jg) {
191190
jg.writeStartObject();

0 commit comments

Comments
 (0)