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 2011/11/13 23:57:39 UTC
svn commit: r1201541 - in /webservices/commons/trunk/modules/axiom/modules:
axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/
axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/
axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/ axiom-testsu...
Author: veithen
Date: Sun Nov 13 22:57:39 2011
New Revision: 1201541
URL: http://svn.apache.org/viewvc?rev=1201541&view=rev
Log:
AXIOM-398: Removed some code that was originally introduced as a workaround for a serialization issue but that is no longer necessary.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalized.java (with props)
Modified:
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
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1201541&r1=1201540&r2=1201541&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java Sun Nov 13 22:57:39 2011
@@ -964,7 +964,7 @@ public class ElementImpl extends ParentN
* @see org.apache.axiom.om.OMElement#getNamespace()
*/
public OMNamespace getNamespace() {
- return namespace != null ? namespace : getDefaultNamespace();
+ return namespace;
}
/**
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java?rev=1201541&r1=1201540&r2=1201541&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/test/java/org/apache/axiom/om/impl/dom/OMImplementationTest.java Sun Nov 13 22:57:39 2011
@@ -27,11 +27,8 @@ import org.apache.axiom.ts.om.builder.Te
import org.apache.axiom.ts.om.container.TestSerialize;
import org.apache.axiom.ts.om.document.TestDigest;
import org.apache.axiom.ts.om.element.TestGetChildrenWithName4;
-import org.apache.axiom.ts.om.element.TestGetNamespaceNormalizedWithParser;
-import org.apache.axiom.ts.om.element.TestGetNamespaceNormalizedWithSAXSource;
import org.apache.axiom.ts.om.element.TestGetXMLStreamReaderCDATAEventFromElement;
import org.apache.axiom.ts.om.element.TestGetXMLStreamReaderWithOMSourcedElementDescendant;
-import org.apache.axiom.ts.om.element.TestMultipleDefaultNS;
import org.apache.axiom.ts.om.element.TestSetTextQName;
import org.apache.axiom.ts.om.element.TestSetTextQNameWithEmptyPrefix;
import org.apache.axiom.ts.om.element.TestSetTextQNameWithoutNamespace;
@@ -85,13 +82,6 @@ public class OMImplementationTest extend
// TODO: if there is a comment node surrounded by text, then these text nodes need to be merged
builder.exclude(TestDigest.class, "(|(file=digest3.xml)(file=digest4.xml))");
- // TODO: AXIOM-398
- builder.exclude(TestGetNamespaceNormalizedWithParser.class);
- builder.exclude(TestGetNamespaceNormalizedWithSAXSource.class);
-
- // TODO: investigate this
- builder.exclude(TestMultipleDefaultNS.class);
-
return builder.build();
}
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=1201541&r1=1201540&r2=1201541&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java Sun Nov 13 22:57:39 2011
@@ -74,8 +74,6 @@ public class OMElementImpl extends OMNod
private static final Log log = LogFactory.getLog(OMElementImpl.class);
- public static final OMNamespace DEFAULT_DEFAULT_NS_OBJECT = new OMNamespaceImpl("", "");
-
/** Field ns */
protected OMNamespace ns;
@@ -966,19 +964,6 @@ public class OMElementImpl extends OMNod
}
public OMNamespace getNamespace() {
-// return ns != null ? ns : DEFAULT_DEFAULT_NS_OBJECT;
- if (ns == null) {
- // User wants to keep this element in the default default namespace. Let's try to see the default namespace
- // is overriden by some one up in the tree
- OMNamespace parentDefaultNS = this.findNamespaceURI("");
-
- if (parentDefaultNS != null && !"".equals(parentDefaultNS.getNamespaceURI())) {
- // if it was overriden, then we must explicitly declare default default namespace as the namespace
- // of this element
- ns = DEFAULT_DEFAULT_NS_OBJECT;
- this.qName = null;
- }
- }
return ns;
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java?rev=1201541&r1=1201540&r2=1201541&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/OMTestSuiteBuilder.java Sun Nov 13 22:57:39 2011
@@ -157,6 +157,7 @@ public class OMTestSuiteBuilder extends
addTest(new org.apache.axiom.ts.om.element.TestGetFirstChildWithNameOnIncompleteElement(metaFactory));
addTest(new org.apache.axiom.ts.om.element.TestGetNamespaceContext(metaFactory, false));
addTest(new org.apache.axiom.ts.om.element.TestGetNamespaceContext(metaFactory, true));
+ addTest(new org.apache.axiom.ts.om.element.TestGetNamespaceNormalized(metaFactory));
addTest(new org.apache.axiom.ts.om.element.TestGetNamespaceNormalizedWithParser(metaFactory));
addTest(new org.apache.axiom.ts.om.element.TestGetNamespaceNormalizedWithSAXSource(metaFactory));
addTest(new org.apache.axiom.ts.om.element.TestGetNamespacesInScope(metaFactory));
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalized.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalized.java?rev=1201541&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalized.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalized.java Sun Nov 13 22:57:39 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.element;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNamedInformationItem;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests that {@link OMNamedInformationItem#getNamespace()} returns <code>null</code> for an element
+ * with no namespace. The case considered in this test is a programmatically created element without
+ * namespace that is added as a child to another element that has a default namespace. Earlier
+ * versions of Axiom returned a non null value in this case to work around an issue in the
+ * serialization code.
+ * <p>
+ * This is a regression test for <a
+ * href="https://issues.apache.org/jira/browse/AXIOM-398">AXIOM-398</a>.
+ */
+public class TestGetNamespaceNormalized extends AxiomTestCase {
+ public TestGetNamespaceNormalized(OMMetaFactory metaFactory) {
+ super(metaFactory);
+ }
+
+ protected void runTest() throws Throwable {
+ OMFactory factory = metaFactory.getOMFactory();
+ OMElement parent = factory.createOMElement("parent", "urn:test", "");
+ OMElement child = factory.createOMElement("child", null);
+ parent.addChild(child);
+ assertNull(child.getNamespace());
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetNamespaceNormalized.java
------------------------------------------------------------------------------
svn:eol-style = native