You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jena.apache.org by GitBox <gi...@apache.org> on 2022/07/18 10:58:24 UTC

[GitHub] [jena] namedgraph opened a new issue, #1450: NPE: Cannot invoke "String.equals(Object)" because "prefix" is null

namedgraph opened a new issue, #1450:
URL: https://github.com/apache/jena/issues/1450

   ### Version
   
   4.5.0
   
   ### What happened?
   
   Writing Model as RDF/XML started giving this exception. I cannot pinpoint any changes that could have caused it, the code in this area has been stable for a long time. I can serialize the same model as Turtle (and then re-serialize as RDF/XML using riot CLI) just fine. The data can be provided if it helps.
   
   Some investigation I did:
   * `this.getPrefixFor( value )` returns `null`, where value is `http://www.w3.org/2001/XMLSchema#`: https://github.com/apache/jena/blob/main/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/BaseXMLWriter.java#L229
   * `Relation::backwards` returns `null` because `http://www.w3.org/2001/XMLSchema#` is not in the `cols` map: https://github.com/apache/jena/blob/main/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/Relation.java#L204
   
   ### Relevant output and stacktrace
   
   ```shell
   java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "prefix" is null
   org.apache.jena.rdfxml.xmloutput.impl.BaseXMLWriter.checkLegalPrefix(BaseXMLWriter.java:845)
   org.apache.jena.rdfxml.xmloutput.impl.BaseXMLWriter.setNsPrefix(BaseXMLWriter.java:324)
   org.apache.jena.rdfxml.xmloutput.impl.BaseXMLWriter.primeNamespace(BaseXMLWriter.java:232)
   org.apache.jena.rdfxml.xmloutput.impl.BaseXMLWriter.setupNamespaces(BaseXMLWriter.java:482)
   org.apache.jena.rdfxml.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:466)
   org.apache.jena.rdfxml.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:456)
   com.atomgraph.linkeddatahub.server.io.ValidatingModelProvider.write(ValidatingModelProvider.java:129)
   ```
   
   
   ### Are you interested in making a pull request?
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] namedgraph closed issue #1450: NPE: Cannot invoke "String.equals(Object)" because "prefix" is null

Posted by GitBox <gi...@apache.org>.
namedgraph closed issue #1450: NPE: Cannot invoke "String.equals(Object)" because "prefix" is null
URL: https://github.com/apache/jena/issues/1450


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] afs commented on issue #1450: NPE: Cannot invoke "String.equals(Object)" because "prefix" is null

Posted by GitBox <gi...@apache.org>.
afs commented on issue #1450:
URL: https://github.com/apache/jena/issues/1450#issuecomment-1193282457

   Status? If there isn't anything actionable about Jena, this should be closed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] namedgraph commented on issue #1450: NPE: Cannot invoke "String.equals(Object)" because "prefix" is null

Posted by GitBox <gi...@apache.org>.
namedgraph commented on issue #1450:
URL: https://github.com/apache/jena/issues/1450#issuecomment-1188294089

   @afs I'm trying to narrow this down.
   
   It looks like it's caused by my `OntModelReadOnly` implementation. This gives the NPE:
   ```
   new org.apache.jena.rdfxml.xmloutput.impl.Basic().write(new OntModelReadOnly(ontModel)), System.out, null);
   ```
   while this succeeds:
   ```
   new org.apache.jena.rdfxml.xmloutput.impl.Basic().write(ontModel), System.out, null);
   ```
   
   Could it be because my subclass is denying access to the `*NsPrefix` methods?
   https://github.com/AtomGraph/Processor/blob/master/src/main/java/com/atomgraph/processor/util/OntModelReadOnly.java#L1436
   I'll try allowing them.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] namedgraph commented on issue #1450: NPE: Cannot invoke "String.equals(Object)" because "prefix" is null

Posted by GitBox <gi...@apache.org>.
namedgraph commented on issue #1450:
URL: https://github.com/apache/jena/issues/1450#issuecomment-1188631543

   The NPE went away when I removed my implementation. I'll try to make a standalone example.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] namedgraph commented on issue #1450: NPE: Cannot invoke "String.equals(Object)" because "prefix" is null

Posted by GitBox <gi...@apache.org>.
namedgraph commented on issue #1450:
URL: https://github.com/apache/jena/issues/1450#issuecomment-1188626047

   That didn't help... I'll try removing `OntModelReadOnly` usages altogether.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] afs commented on issue #1450: NPE: Cannot invoke "String.equals(Object)" because "prefix" is null

Posted by GitBox <gi...@apache.org>.
afs commented on issue #1450:
URL: https://github.com/apache/jena/issues/1450#issuecomment-1187280257

   > The data can be provided if it helps.
   
   A minimal, reproducible example please.
   
   Minimal code, minimal data. 
   
   Does the example work in previous versions?
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org


[GitHub] [jena] namedgraph commented on issue #1450: NPE: Cannot invoke "String.equals(Object)" because "prefix" is null

Posted by GitBox <gi...@apache.org>.
namedgraph commented on issue #1450:
URL: https://github.com/apache/jena/issues/1450#issuecomment-1193659213

   Nothing actionable right now because I'm on vacation. Might reopen later when I have time to build a test case.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org