tristan/jsonld-java — Issue #8: NullPointerException serializing to raw json
Author: wikier
Created: 2012-02-29 09:08:35+00:00
State: open

With the current verison of the code the repository, I'm getting:

java.lang.NullPointerException
at de.dfki.km.json.jsonld.JSONLDUtils.compactIRI(JSONLDUtils.java:145)
at de.dfki.km.json.jsonld.impl.JSONLDProcessorImpl.compact(JSONLDProcessorImpl.java:350)
at de.dfki.km.json.jsonld.impl.JSONLDProcessorImpl.compact(JSONLDProcessorImpl.java:243)
at de.dfki.km.json.jsonld.impl.JSONLDProcessorImpl.compact(JSONLDProcessorImpl.java:168)
at de.dfki.km.json.jsonld.JSONLDSerializer.asObject(JSONLDSerializer.java:167)
at org.fundacionctic.su4j.endpoint.formatter.JSONLDFormatter.serialize(JSONLDFormatter.java:43)
at org.fundacionctic.su4j.endpoint.formatter.SparqlHttpResultFormatter.format(SparqlHttpResultFormatter.java:84)
at org.fundacionctic.su4j.endpoint.DefaultSparqlEndpoint.query(DefaultSparqlEndpoint.java:263)
at org.fundacionctic.su4j.endpoint.demo.SparqlServlet.doGet(SparqlServlet.java:31)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)

Both with serializer.asString() and JSONUtils.toString(serializer.asObject())

The code is available at https://bitbucket.org/fundacionctic/su4j/src/76d923ce89e5/libs/su4j-endpoint/src/main/java/org/fundacionctic/su4j/endpoint/formatter/JSONLDFormatter.java#cl-43