Based on this code (I'm guessing on the line numbers, but I'm pretty sure I'm right):
/* 69 */ InputStream in = this.getClass().getClassLoader().getResourceAsStream("data/nts/100.nt");
/* 70 */ traceModel.read(in, xmlbase, "N-TRIPLE");
and the beginning of the stacktrace:
java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:78)
at java.io.InputStreamReader.<init>(InputStreamReader.java:129)
at com.hp.hpl.jena.util.FileUtils.asUTF8(FileUtils.java:51)
at com.hp.hpl.jena.rdf.model.impl.NTripleReader.read(NTripleReader.java:72)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:226)
…
I'd guess that in
is null
. Maybe that pathname needs to be "/data/nts/100.nt"
(note the /
at the beginning).
The stacktrace contains line numbers, and I'm pretty sure they point you to the problematic line. This is something that shouldn't be too hard to run in a debugger. Even if you can't run it in a debugger, if you're getting a null pointer exception, and you have a reference to a particular line, it's typically a good idea to check which values are used on that line and check whether they're null
or not. In this case, you could just do:
InputStream in = this.getClass().getClassLoader().getResourceAsStream("data/nts/100.nt");
Objects.requireNonNull( in, "InputStream for resource data/nts/100.nt should not be null." );
traceModel.read(in, xmlbase, "N-TRIPLE");