You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2012/11/13 23:14:46 UTC

svn commit: r1408984 - in /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl: OMElementEx.java builder/StAXOMBuilder.java

Author: veithen
Date: Tue Nov 13 22:14:45 2012
New Revision: 1408984

URL: http://svn.apache.org/viewvc?rev=1408984&view=rev
Log:
AXIOM-441: Fixed an IllegalArgumentException that occurs with empty default namespace attributes if the StAX implementation in OpenJDK 7 is used. Note that this XML construct is amply covered by the test suites, but right now we don't have a simple way to execute them against the OpenJDK StAX implementation.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMElementEx.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMElementEx.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMElementEx.java?rev=1408984&r1=1408983&r2=1408984&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMElementEx.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMElementEx.java Tue Nov 13 22:14:45 2012
@@ -35,9 +35,9 @@ public interface OMElementEx extends OME
      * declare the default namespace.
      * 
      * @param uri
-     *            the namespace to declare
+     *            the namespace to declare; must not be <code>null</code>
      * @param prefix
-     *            the prefix to associate with the given namespace
+     *            the prefix to associate with the given namespace; must not be <code>null</code>
      * @return the created namespace information item
      */
     OMNamespace addNamespaceDeclaration(String uri, String prefix);

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java?rev=1408984&r1=1408983&r2=1408984&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java Tue Nov 13 22:14:45 2012
@@ -565,14 +565,19 @@ public class StAXOMBuilder extends StAXB
             // check whether this is the default namespace and make sure we have not declared that earlier
             String namespaceURI = parser.getNamespaceURI(i);
             
-            // NOTE_A:
-            // By default most parsers don't intern the namespace.
-            // Unfortunately the property to detect interning on the delegate parsers is hard to detect.
-            // Woodstox has a proprietary property on the XMLInputFactory.
-            // IBM has a proprietary property on the XMLStreamReader.
-            // For now only force the interning if requested.
-            if (isNamespaceURIInterning()) {
-                namespaceURI = namespaceURI.intern();
+            if (namespaceURI == null) {
+                // No need to care about interning here; String literals are always interned
+                namespaceURI = "";
+            } else {
+                // NOTE_A:
+                // By default most parsers don't intern the namespace.
+                // Unfortunately the property to detect interning on the delegate parsers is hard to detect.
+                // Woodstox has a proprietary property on the XMLInputFactory.
+                // IBM has a proprietary property on the XMLStreamReader.
+                // For now only force the interning if requested.
+                if (isNamespaceURIInterning()) {
+                    namespaceURI = namespaceURI.intern();
+                }
             }
             
             if (prefix == null) {