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 2016/06/15 07:05:36 UTC
svn commit: r1748504 - in /webservices/axiom/trunk/aspects/core-aspects/src:
main/java/org/apache/axiom/core/stream/
test/java/org/apache/axiom/core/stream/
Author: veithen
Date: Wed Jun 15 07:05:36 2016
New Revision: 1748504
URL: http://svn.apache.org/viewvc?rev=1748504&view=rev
Log:
AXIOM-376: Trigger exceptions for conflicts detected during namespace repairing.
Added:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/ConflictingNamespaceDeclarationException.java (with props)
webservices/axiom/trunk/aspects/core-aspects/src/test/java/org/apache/axiom/core/stream/NamespaceRepairingFilterTest.java (with props)
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/NamespaceRepairingFilterHandler.java
Added: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/ConflictingNamespaceDeclarationException.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/ConflictingNamespaceDeclarationException.java?rev=1748504&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/ConflictingNamespaceDeclarationException.java (added)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/ConflictingNamespaceDeclarationException.java Wed Jun 15 07:05:36 2016
@@ -0,0 +1,27 @@
+/*
+ * 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.core.stream;
+
+public class ConflictingNamespaceDeclarationException extends StreamException {
+ private static final long serialVersionUID = 1L;
+
+ public ConflictingNamespaceDeclarationException(String message) {
+ super(message);
+ }
+}
Propchange: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/ConflictingNamespaceDeclarationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/NamespaceRepairingFilterHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/NamespaceRepairingFilterHandler.java?rev=1748504&r1=1748503&r2=1748504&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/NamespaceRepairingFilterHandler.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/NamespaceRepairingFilterHandler.java Wed Jun 15 07:05:36 2016
@@ -105,8 +105,7 @@ public final class NamespaceRepairingFil
if (namespaceStack[i*2+1].equals(namespaceURI)) {
return;
} else {
- // TODO: this causes a failure in the FOM tests
-// throw new OMException("The same prefix cannot be bound to two different namespaces");
+ throw new ConflictingNamespaceDeclarationException("The same prefix cannot be bound to two different namespaces");
}
}
}
Added: webservices/axiom/trunk/aspects/core-aspects/src/test/java/org/apache/axiom/core/stream/NamespaceRepairingFilterTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/test/java/org/apache/axiom/core/stream/NamespaceRepairingFilterTest.java?rev=1748504&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/test/java/org/apache/axiom/core/stream/NamespaceRepairingFilterTest.java (added)
+++ webservices/axiom/trunk/aspects/core-aspects/src/test/java/org/apache/axiom/core/stream/NamespaceRepairingFilterTest.java Wed Jun 15 07:05:36 2016
@@ -0,0 +1,34 @@
+/*
+ * 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.core.stream;
+
+import org.junit.Test;
+
+public class NamespaceRepairingFilterTest {
+ @Test(expected=ConflictingNamespaceDeclarationException.class)
+ public void testNamespaceDeclarationConflictingWithElementName() throws StreamException {
+ XmlHandler handler = new NamespaceRepairingFilter(null, false).createFilterHandler(NullXmlHandler.INSTANCE);
+ handler.startFragment();
+ handler.startElement("urn:ns1", "test", "p");
+ handler.processNamespaceDeclaration("p", "urn:ns2");
+ handler.attributesCompleted();
+ handler.endElement();
+ handler.completed();
+ }
+}
Propchange: webservices/axiom/trunk/aspects/core-aspects/src/test/java/org/apache/axiom/core/stream/NamespaceRepairingFilterTest.java
------------------------------------------------------------------------------
svn:eol-style = native