jaxb
  1. jaxb
  2. JAXB-795

Catalog passed to XJC is not used during the schema correctness check

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 2.2.1
    • Fix Version/s: 2.2.5
    • Component/s: xjc
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      When Catalog is passed to XJC, it is used to resolve imported schemas while
      building the forest, but during schema correctness check, it does not set the
      entity resolver. In com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.java#230,
      EntityResolver is not set on the SchemaFactory. This results in to unnecessary
      warning thrown during schema resolution.
      See the original issue filed on jax-ws: http://java.net/jira/browse/JAX_WS-900

        Issue Links

          Activity

          Hide
          Pavel Bucek added a comment -

          too late to get into jaxb 2.2.2

          fixed in trunk (waiting for tck tests), merge to branches might be delayed
          because of kenai migration.

          Show
          Pavel Bucek added a comment - too late to get into jaxb 2.2.2 fixed in trunk (waiting for tck tests), merge to branches might be delayed because of kenai migration.
          Hide
          basdebakker14 added a comment -

          I think the fix introduced in 2.2.3 is insufficient. The problem is that the systemId passed to the LSResourceResolver may be a relative URI (it is the systemId as was written in the schema). It is now passed as is to the SAX EntityResolver set on the compiler. However, the latter cannot use it as it does not have the baseURI available.

          If the systemId is relative, it should first be resolved against the baseURI before being passed to the EntityResolver.

          (Note that I'm not using a Catalog, I'm passing my own EntityResolver to the SchemaCompiler.setEntityResolver() API.)

          Show
          basdebakker14 added a comment - I think the fix introduced in 2.2.3 is insufficient. The problem is that the systemId passed to the LSResourceResolver may be a relative URI (it is the systemId as was written in the schema). It is now passed as is to the SAX EntityResolver set on the compiler. However, the latter cannot use it as it does not have the baseURI available. If the systemId is relative, it should first be resolved against the baseURI before being passed to the EntityResolver. (Note that I'm not using a Catalog, I'm passing my own EntityResolver to the SchemaCompiler.setEntityResolver() API.)
          Hide
          Pavel Bucek added a comment -

          basdebakker14, can you please share test case?

          Show
          Pavel Bucek added a comment - basdebakker14, can you please share test case?
          Hide
          basdebakker14 added a comment -

          To run test:

          1. Unpack jaxbtest795.zip, go to jaxbtest795 directory.
          2. Make sure JAXB jars are on classpath.
          3. Compile src/JaxbTest795.java.
          4. Run it from jaxbtest795 directory.

          The schema compilation will succeed, but the schema correctness check fails. The reason is that during the correctness check, the entity resolver only sees the relative URI "schema3.xsd" and has no way to know that this is referenced from a schema in "subdir".

          Show
          basdebakker14 added a comment - To run test: 1. Unpack jaxbtest795.zip, go to jaxbtest795 directory. 2. Make sure JAXB jars are on classpath. 3. Compile src/JaxbTest795.java. 4. Run it from jaxbtest795 directory. The schema compilation will succeed, but the schema correctness check fails. The reason is that during the correctness check, the entity resolver only sees the relative URI "schema3.xsd" and has no way to know that this is referenced from a schema in "subdir".
          Hide
          donatasc added a comment -

          Why is this issue tagged as incomplete? What is missing?

          Show
          donatasc added a comment - Why is this issue tagged as incomplete? What is missing?
          Hide
          Martin Grebac added a comment -

          I think it was incomplete until the testcase was delivered and not marked back since then.

          Show
          Martin Grebac added a comment - I think it was incomplete until the testcase was delivered and not marked back since then.

            People

            • Assignee:
              Iaroslav Savytskyi
              Reporter:
              ramapulavarthi
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: