[ 
https://issues.apache.org/jira/browse/JENA-251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13290507#comment-13290507
 ] 

Damian Steer edited comment on JENA-251 at 6/6/12 10:25 PM:
------------------------------------------------------------

Thanks for the test case Mike.

The issue is that RiotLoader.readTriples(...) is being called with a null 
baseURI.

In 2.9.0-incubating RiotReader#createParserTriples(...) did:

if ( lang == RDFXML )
            return LangRDFXML.create(input, baseIRI, baseIRI, 
ErrorHandlerFactory.errorHandlerStd, sink) ;

however 2.9.1-snapshot does:

if ( lang == RDFXML )
        {
            baseIRI = IRIResolver.resolveString(baseIRI) ;
            return LangRDFXML.create(input, baseIRI, baseIRI, 
ErrorHandlerFactory.errorHandlerStd, sink) ;
        }

(I think the intention is to allow relative baseIRIs to resolve relative to the 
current directory)

The current version is less forgiving because of this explicit attempt to 
resolve baseIRI. Previously it would only complain if there were relative IRIs 
in the RDF/XML file. We could treat null as "" and issue a warning? Or Mike 
could change null to "".
                
      was (Author: shellac):
    Thanks for the test case Mike.

The issue is that RiotLoader.readTriples(...) is being called with a null 
baseURI.

In 2.9.0-incubating RiotReader#createParserTriples(...) did:

if ( lang == RDFXML )
            return LangRDFXML.create(input, baseIRI, baseIRI, 
ErrorHandlerFactory.errorHandlerStd, sink) ;

however 2.9.1-snapshot does:

if ( lang == RDFXML )
        {
            baseIRI = IRIResolver.resolveString(baseIRI) ;
            return LangRDFXML.create(input, baseIRI, baseIRI, 
ErrorHandlerFactory.errorHandlerStd, sink) ;
        }

(I think the intention is to allow relative baseIRIs to resolve relative to the 
current directory)

The current version is thus less forgiving. We could treat null as "" and issue 
a warning? Or  Mike could change null to "".
                  
> IRI throws a NullPointerException when RiotLoader reads an RDF/XML file while 
> using dependencies of jena-sb 1.3.4-SNAPSHOT
> --------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JENA-251
>                 URL: https://issues.apache.org/jira/browse/JENA-251
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: RIOT
>    Affects Versions: SDB 1.3.4
>         Environment: Apache Maven 3.0.3
> Java version: 1.6.0_31, vendor: Apple Inc.
> OS name: "mac os x", version: "10.7.4", arch: "x86_64", family: "mac"
> Default locale: en_US, platform encoding: MacRoman
>            Reporter: Mike Jones
>         Attachments: Sample.tar.gz
>
>
> A project I'm working on loads files at runtime and updates URIs that have 
> place holders with the domain a web application is deployed, prior to being 
> saved to a default or named graph with SDB. For example, mca://foo/bar/  
> becomes http://m.bristol.ac.uk/foo/bar/. After the jena-sdb version become 
> 1.3.4-SNAPSHOT some of the RDF XML files were failing with the following 
> exception:
> java.lang.NullPointerException
>       at java.util.regex.Matcher.getTextLength(Matcher.java:1140)
>       at java.util.regex.Matcher.reset(Matcher.java:291)
>       at java.util.regex.Matcher.<init>(Matcher.java:211)
>       at java.util.regex.Pattern.matcher(Pattern.java:888)
>       at org.apache.jena.iri.impl.Parser.<init>(Parser.java:89)
>       at org.apache.jena.iri.impl.IRIImpl.<init>(IRIImpl.java:65)
>       at org.apache.jena.iri.impl.AbsIRIImpl.create(AbsIRIImpl.java:692)
>       at org.apache.jena.iri.IRI.resolve(IRI.java:432)
>       at 
> org.openjena.riot.system.IRIResolver$IRIResolverNormal.resolveSilent(IRIResolver.java:435)
>       at 
> org.openjena.riot.system.IRIResolver$IRIResolverNormal.resolve(IRIResolver.java:420)
>       at org.openjena.riot.system.IRIResolver.resolveIRI(IRIResolver.java:199)
>       at 
> org.openjena.riot.system.IRIResolver.resolveString(IRIResolver.java:189)
>       at org.openjena.riot.RiotReader.createParserTriples(RiotReader.java:144)
>       at org.openjena.riot.RiotLoader.readTriples(RiotLoader.java:215)
> I've created a reduced sample test case (using maven). If you use the 
> dependencies linked to jena-sdb (1.3.4-SNAPSHOT) you will get the stack trace 
> above with mvn test. If you replace the dependencies with jena-arq 
> (2.9.0-incubating) and run mvn clean and mvn test you won't get an error but 
> will see a list of URIs being printed to standard out.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to