WS-Commons
  1. WS-Commons
  2. WSCOMMONS-537

Cached NodeNamespaceContext causes problems when a new namespace is added

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: XmlSchema 1.4.3
    • Fix Version/s: XmlSchema 1.4.7
    • Component/s: XmlSchema
    • Labels:
      None

      Description

      The NodeNamespaceContext caching added between 1.4.2 and 1.4.3 causes problems when dynamically adding a new namespace to an existing document.

      Calling XmlSchemaCollection.read() will cause the NodeNamespaceContext to be cached in the UserData for the document.

      If you then add a new namespace declaration to the document, the cached value will not be invalidated or updated. Adding an element that uses the new declaration in its type and calling XMLSchemaCollection.read() with the document as an argument will result in the following exception:

      java.lang.IllegalStateException: The prefix tns is not bound.
      at org.apache.ws.commons.schema.SchemaBuilder.getRefQName(SchemaBuilder.java:593)
      at org.apache.ws.commons.schema.SchemaBuilder.getRefQName(SchemaBuilder.java:566)
      at org.apache.ws.commons.schema.SchemaBuilder.handleElement(SchemaBuilder.java:1406)
      at org.apache.ws.commons.schema.SchemaBuilder.handleSequence(SchemaBuilder.java:964)
      at org.apache.ws.commons.schema.SchemaBuilder.handleComplexType(SchemaBuilder.java:661)
      at org.apache.ws.commons.schema.SchemaBuilder.handleElement(SchemaBuilder.java:1433)
      at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:210)
      at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:121)
      at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:509)
      at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:493)

      1. test.xsd
        0.4 kB
        Brent Daniel
      2. XSDTest.java
        2 kB
        Brent Daniel

        Issue Links

          Activity

            People

            • Assignee:
              Daniel Kulp
              Reporter:
              Brent Daniel
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development