You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/04/08 16:22:53 UTC
cvs commit: ws-axis/java/test/message TestMessageElement.java
dims 2005/04/08 07:22:53
Modified: java/src/org/apache/axis/message MessageElement.java
java/test/message TestMessageElement.java
Log:
Fix for AXIS-1889 - Problem with namespace handling in Axis 1.2 : break XML Signature
from Guillaume Sauthier
Revision Changes Path
1.196 +1 -1 ws-axis/java/src/org/apache/axis/message/MessageElement.java
Index: MessageElement.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/message/MessageElement.java,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -r1.195 -r1.196
--- MessageElement.java 18 Feb 2005 13:03:58 -0000 1.195
+++ MessageElement.java 8 Apr 2005 14:22:53 -0000 1.196
@@ -2014,7 +2014,7 @@
att.getNamespaceURI().equals(Constants.NS_URI_XMLNS) &&
"xmlns".equals(att.getPrefix())) {
Mapping map = new Mapping(att.getNodeValue(), att.getLocalName());
- addMapping(map);
+ dest.addMapping(map);
}
if(att.getLocalName() != null) {
dest.addAttribute(att.getPrefix(),
1.20 +20 -1 ws-axis/java/test/message/TestMessageElement.java
Index: TestMessageElement.java
===================================================================
RCS file: /home/cvs/ws-axis/java/test/message/TestMessageElement.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- TestMessageElement.java 18 Feb 2005 13:03:58 -0000 1.19
+++ TestMessageElement.java 8 Apr 2005 14:22:53 -0000 1.20
@@ -306,11 +306,30 @@
this.assertXMLEqual(xmlIn,xmlOut);
}
+ public void testElementConstructorUsingNamespaces() throws Exception {
+ String xmlIn = "<ns1:document xmlns:ns1=\"urn:someURI\">\n" +
+ " <ns2:child-element xmlns:ns2=\"urn:someOtherURI\">\n" +
+ " some text nodes insides\n" +
+ " </ns2:child-element>\n" +
+ "</ns1:document>";
+
+ Document doc = XMLUtils.newDocument(new ByteArrayInputStream(xmlIn.getBytes()));
+ MessageElement me = new MessageElement(doc.getDocumentElement());
+ String xmlOut = me.getAsString();
+ System.out.println(xmlOut);
+ // check that the String version of the XML are the same :
+ // I ensure that the namespaces declaration have not been moved
+ // this is needed when some elements are signed :
+ // we sign an element (get a Hashcode)
+ // if the serialization change that element, the Hashcode will
+ // change and the signature check will fail.
+ this.assertEquals(xmlIn, xmlOut);
+ }
/**
* Test setting the text value on a MessageElement in various ways.
*
* @throws Exception on error
- */
+ */
public void testSetValue() throws Exception
{
MessageElement me;