Axiom
  1. Axiom
  2. AXIOM-398

Return value of OMNamedInformationItem#getNamespace() should be normalized

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.12
    • Fix Version/s: 1.2.13
    • Component/s: API
    • Labels:
      None

      Description

      For elements and attributes without namespace, getNamespace() may return two different values: null or an OMNamespace instance that has both prefix and namespaceURI properties set to the empty string. The value that is actually returned in this case depends in subtle ways on how the information item was created. This can be illustrated by the following code snippet:

      OMElement element1 = AXIOMUtil.stringToOM("<root/>");
      System.out.println(element1.getNamespace());
      OMElement element2 = AXIOMUtil.stringToOM("<root xmlns=''/>");
      System.out.println(element2.getNamespace());

      The output is:

      null
      org.apache.axiom.om.impl.common.OMNamespaceImpl@0

      One can see that although the two elements are equivalent, the return value of getNamespace() is different.

      The return value of getNamespace() should be normalized such that it is always the same (i.e. null) for information items without namespace.

        Activity

        Hide
        Hudson added a comment -

        Integrated in ws-axiom-trunk #688 (See https://builds.apache.org/job/ws-axiom-trunk/688/)
        Added some test cases for AXIOM-398.

        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithParser.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithSAXSource.java
        Show
        Hudson added a comment - Integrated in ws-axiom-trunk #688 (See https://builds.apache.org/job/ws-axiom-trunk/688/ ) Added some test cases for AXIOM-398 . veithen : Files : /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithParser.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalizedWithSAXSource.java
        Hide
        Hudson added a comment -

        Integrated in ws-axiom-trunk #690 (See https://builds.apache.org/job/ws-axiom-trunk/690/)
        AXIOM-398: Enabled a test for a particular case that was actually fixed by r1201478.

        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
        Show
        Hudson added a comment - Integrated in ws-axiom-trunk #690 (See https://builds.apache.org/job/ws-axiom-trunk/690/ ) AXIOM-398 : Enabled a test for a particular case that was actually fixed by r1201478. veithen : Files : /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
        Hide
        Hudson added a comment -

        Integrated in ws-axiom-trunk #691 (See https://builds.apache.org/job/ws-axiom-trunk/691/)
        AXIOM-398: Fixed the handling of default namespaces in SAXOMBuilder by reusing the same code as in StAXOMBuilder. Note that there is still a problem in DOOM somewhere.

        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/BuilderUtil.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
        Show
        Hudson added a comment - Integrated in ws-axiom-trunk #691 (See https://builds.apache.org/job/ws-axiom-trunk/691/ ) AXIOM-398 : Fixed the handling of default namespaces in SAXOMBuilder by reusing the same code as in StAXOMBuilder. Note that there is still a problem in DOOM somewhere. veithen : Files : /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/BuilderUtil.java /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/SAXOMBuilder.java /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/test/java/org/apache/axiom/om/impl/llom/OMImplementationTest.java
        Hide
        Hudson added a comment -

        Integrated in ws-axiom-trunk #693 (See https://builds.apache.org/job/ws-axiom-trunk/693/)
        AXIOM-398: Removed some code that was originally introduced as a workaround for a serialization issue but that is no longer necessary.

        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalized.java
        Show
        Hudson added a comment - Integrated in ws-axiom-trunk #693 (See https://builds.apache.org/job/ws-axiom-trunk/693/ ) AXIOM-398 : Removed some code that was originally introduced as a workaround for a serialization issue but that is no longer necessary. veithen : Files : /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalized.java
        Hide
        Hudson added a comment -

        Integrated in ws-axiom-trunk #712 (See https://builds.apache.org/job/ws-axiom-trunk/712/)
        AXIOM-398: Normalize the return value of getNamespace for OMElement and OMSourcedElement instances.

        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamedInformationItem.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalized.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/TestGetNamespaceNormalized.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/TestName1Unqualified.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/TestName2Unqualified.java
        Show
        Hudson added a comment - Integrated in ws-axiom-trunk #712 (See https://builds.apache.org/job/ws-axiom-trunk/712/ ) AXIOM-398 : Normalize the return value of getNamespace for OMElement and OMSourcedElement instances. veithen : Files : /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMNamedInformationItem.java /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalized.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/TestGetNamespaceNormalized.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/TestName1Unqualified.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/TestName2Unqualified.java
        Hide
        Hudson added a comment -

        Integrated in ws-axiom-trunk #767 (See https://builds.apache.org/job/ws-axiom-trunk/767/)
        AXIOM-398: Committed a couple of changes that were missing in r1215506.
        AXIOM-398: Also normalize the result of OMElement#getDefaultNamespace().

        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetDefaultNamespace2.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/TestName1Unqualified.java

        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
        Show
        Hudson added a comment - Integrated in ws-axiom-trunk #767 (See https://builds.apache.org/job/ws-axiom-trunk/767/ ) AXIOM-398 : Committed a couple of changes that were missing in r1215506. AXIOM-398 : Also normalize the result of OMElement#getDefaultNamespace(). veithen : Files : /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetDefaultNamespace2.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/sourcedelement/TestName1Unqualified.java veithen : Files : /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
        Hide
        Hudson added a comment -

        Integrated in ws-axiom-trunk #776 (See https://builds.apache.org/job/ws-axiom-trunk/776/)
        AXIOM-398: Normalize the return value of getNamespace for OMAttribute instances.

        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/attribute/TestGetNamespaceNormalized.java
        Show
        Hudson added a comment - Integrated in ws-axiom-trunk #776 (See https://builds.apache.org/job/ws-axiom-trunk/776/ ) AXIOM-398 : Normalize the return value of getNamespace for OMAttribute instances. veithen : Files : /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/AttrImpl.java /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMAttributeImpl.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/attribute/TestGetNamespaceNormalized.java
        Hide
        Hudson added a comment -

        Integrated in ws-axiom-trunk #789 (See https://builds.apache.org/job/ws-axiom-trunk/789/)
        AXIOM-398: Ensure that the return value of getNamespace() is correctly normalized for elements created using Document#createElementNS.

        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/pom.xml
        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateAttributeNSWithoutNamespace.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNSWithoutNamespace.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/test/java/org/apache/axiom/ts/dom/XercesTest.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
        Show
        Hudson added a comment - Integrated in ws-axiom-trunk #789 (See https://builds.apache.org/job/ws-axiom-trunk/789/ ) AXIOM-398 : Ensure that the return value of getNamespace() is correctly normalized for elements created using Document#createElementNS. veithen : Files : /webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/pom.xml /webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/DOMTestSuiteBuilder.java /webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateAttributeNSWithoutNamespace.java /webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/main/java/org/apache/axiom/ts/dom/document/TestCreateElementNSWithoutNamespace.java /webservices/commons/trunk/modules/axiom/modules/axiom-dom-testsuite/src/test/java/org/apache/axiom/ts/dom/XercesTest.java /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
        Hide
        Hudson added a comment -

        Integrated in ws-axiom-trunk #839 (See https://builds.apache.org/job/ws-axiom-trunk/839/)
        Added documentation about AXIOM-398 to the user guide. (Revision 1308150)

        Result = SUCCESS
        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/src/docbkx/userguide.xml
        Show
        Hudson added a comment - Integrated in ws-axiom-trunk #839 (See https://builds.apache.org/job/ws-axiom-trunk/839/ ) Added documentation about AXIOM-398 to the user guide. (Revision 1308150) Result = SUCCESS veithen : Files : /webservices/commons/trunk/modules/axiom/src/docbkx/userguide.xml
        Hide
        Hudson added a comment -

        Integrated in ws-axiom-trunk #934 (See https://builds.apache.org/job/ws-axiom-trunk/934/)
        Fixed a couple of issues in SOAPEnvelope#getSOAPBodyFirstElementNS() and SOAPBody#getFirstElementNS():

        • The return value should be normalized in the same way as for OMNamedInformationItem#getNamespace() (see AXIOM-398).
        • Don't return an OMNamespace instance with a null prefix. (Revision 1333588)

        Result = SUCCESS
        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPBody.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPEnvelope.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestGetSOAPBodyFirstElementLocalNameAndNS.java
        • /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestGetSOAPBodyFirstElementLocalNameAndNSWithParser.java
        Show
        Hudson added a comment - Integrated in ws-axiom-trunk #934 (See https://builds.apache.org/job/ws-axiom-trunk/934/ ) Fixed a couple of issues in SOAPEnvelope#getSOAPBodyFirstElementNS() and SOAPBody#getFirstElementNS(): The return value should be normalized in the same way as for OMNamedInformationItem#getNamespace() (see AXIOM-398 ). Don't return an OMNamespace instance with a null prefix. (Revision 1333588) Result = SUCCESS veithen : Files : /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPBody.java /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPEnvelope.java /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPBodyImpl.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestGetSOAPBodyFirstElementLocalNameAndNS.java /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/envelope/TestGetSOAPBodyFirstElementLocalNameAndNSWithParser.java
        Hide
        Hudson added a comment -

        Integrated in ws-axiom-trunk #1305 (See https://builds.apache.org/job/ws-axiom-trunk/1305/)
        Code simplification / dead code elimination (OMElement#getNamespace never returns a non null OMNamespace with an empty namespace URI; see AXIOM-398). (Revision 1426820)

        Result = SUCCESS
        veithen :
        Files :

        • /webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
        Show
        Hudson added a comment - Integrated in ws-axiom-trunk #1305 (See https://builds.apache.org/job/ws-axiom-trunk/1305/ ) Code simplification / dead code elimination (OMElement#getNamespace never returns a non null OMNamespace with an empty namespace URI; see AXIOM-398 ). (Revision 1426820) Result = SUCCESS veithen : Files : /webservices/commons/trunk/modules/axiom/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java

          People

          • Assignee:
            Andreas Veithen
            Reporter:
            Andreas Veithen
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development