[
https://issues.apache.org/jira/browse/JENA-811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14200673#comment-14200673
]
Matthew Jarvis commented on JENA-811:
-------------------------------------
I found this issue trying to read in a model where the base uri and model
content is coming from an outside source... I'm using the following code to
parse the incoming model:
Model m = ModelFactory.createDefaultModel();
m.read(inputStream, baseUri, "RDF/XML");
I ran into an issue where, in some cases, the baseUri that was provided
contained captial letters in the hostname. Since the spec says lower case
letters are preferred in the hostname, but not absolutely required, I don't
want the model parsing to fail due to that violation. If I'm missing some
other way for me to change the violation handling when parsing a model, I'd be
open to suggestions.
> org.apache.jena.riot.system.IRIResolver doesn't allow for any control over
> violation error/warning settings
> -----------------------------------------------------------------------------------------------------------
>
> Key: JENA-811
> URL: https://issues.apache.org/jira/browse/JENA-811
> Project: Apache Jena
> Issue Type: Bug
> Components: IRI
> Affects Versions: Jena 2.11.2
> Reporter: Matthew Jarvis
> Priority: Minor
>
> The IRIResolver class has a public static iriFactory that is used for
> creating IRIs, but consumers never have a chance to call
> IRIResolver.iriFactory#setIsError or IRIResolver.iriFactory#setIsWarning
> because the iriFactory is used in a static block when the class is loaded.
> Any attempts to call either the setIsError or setIsWarning method throw the
> following exception:
> {noformat}
> java.lang.IllegalStateException: Cannot reinitialize IRIFactory after first
> use.
> at
> org.apache.jena.iri.impl.IRIFactoryImpl.initializing(IRIFactoryImpl.java:255)
> at org.apache.jena.iri.IRIFactory.setIsError(IRIFactory.java:579)
> ...
> {noformat}
> A simple test case that illustrates the problem is:
> {noformat}
> @Test
> public void testIgnoreLowercaseViolation() {
> IRIResolver.iriFactory.setIsError(ViolationCodes.LOWERCASE_PREFERRED,
> false);
> IRIResolver.resolveIRI("http://EXAMPLE.com");
> }
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)