Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-811

org.apache.jena.riot.system.IRIResolver doesn't allow for any control over violation error/warning settings

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Jena 2.11.2
    • Jena 2.13.0
    • IRI
    • None

    Description

      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:

      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)
      ...
      

      A simple test case that illustrates the problem is:

      @Test
      public void testIgnoreLowercaseViolation() {
        IRIResolver.iriFactory.setIsError(ViolationCodes.LOWERCASE_PREFERRED, false);
        IRIResolver.resolveIRI("http://EXAMPLE.com");
      }
      

      Attachments

        Activity

          People

            andy Andy Seaborne
            mpjarvis Matthew Jarvis
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: