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/07/03 20:24:37 UTC
svn commit: r1356862 - in /webservices/commons/trunk/modules/axiom/modules:
axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/
axiom-api/src/test/resources/soap/soap11/
axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/ axiom-testsuite/sr...
Author: veithen
Date: Tue Jul 3 18:24:36 2012
New Revision: 1356862
URL: http://svn.apache.org/viewvc?rev=1356862&view=rev
Log:
Eliminated unnecessary/wrong code in SOAP11BuilderHelper: processText would incorrectly trigger an exception if a comment is encountered; on the other hand, the (unexpected) presence of a child element is already detected elsewhere in the code.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/resources/soap/soap11/faultstring-with-comment.xml (with props)
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultactor.xml (with props)
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultcode.xml (with props)
webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultstring.xml (with props)
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAP11BuilderHelper.java
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.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/builder/OMTestUtils.java
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAP11BuilderHelper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAP11BuilderHelper.java?rev=1356862&r1=1356861&r2=1356862&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAP11BuilderHelper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/SOAP11BuilderHelper.java Tue Jul 3 18:24:36 2012
@@ -20,17 +20,12 @@
package org.apache.axiom.soap.impl.builder;
import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.impl.OMNodeEx;
import org.apache.axiom.om.impl.exception.OMBuilderException;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAPFault;
-import org.apache.axiom.soap.SOAPFaultCode;
-import org.apache.axiom.soap.SOAPFaultReason;
import org.apache.axiom.soap.SOAPProcessingException;
import org.w3c.dom.Element;
-import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
public class SOAP11BuilderHelper extends SOAPBuilderHelper implements SOAP11Constants {
@@ -55,30 +50,17 @@ public class SOAP11BuilderHelper extends
if (SOAP_FAULT_CODE_LOCAL_NAME.equals(localName)) {
- SOAPFaultCode code = factory.createSOAPFaultCode(
+ element = factory.createSOAPFaultCode(
(SOAPFault) parent, builder);
- processNamespaceData(code, false);
- processAttributes(code);
-
- processText(parser, code);
- ((OMNodeEx) code).setComplete(true);
- element = code;
- ((StAXSOAPModelBuilder) builder).adjustElementLevel(-1);
-
+ processNamespaceData(element, false);
+ processAttributes(element);
faultcodePresent = true;
} else if (SOAP_FAULT_STRING_LOCAL_NAME.equals(localName)) {
- SOAPFaultReason reason = factory.createSOAPFaultReason(
+ element = factory.createSOAPFaultReason(
(SOAPFault) parent, builder);
- processNamespaceData(reason, false);
- processAttributes(reason);
-
- processText(parser, reason);
- ((OMNodeEx) reason).setComplete(true);
- element = reason;
- ((StAXSOAPModelBuilder) builder).adjustElementLevel(-1);
-
-
+ processNamespaceData(element, false);
+ processAttributes(element);
faultstringPresent = true;
} else if (SOAP_FAULT_ACTOR_LOCAL_NAME.equals(localName)) {
element =
@@ -139,26 +121,4 @@ public class SOAP11BuilderHelper extends
return element;
}
-
- private void processText(XMLStreamReader parser, OMElement value) {
- try {
- int token = parser.next();
- while (token != XMLStreamReader.END_ELEMENT) {
- if (token == XMLStreamReader.CHARACTERS) {
- factory.createOMText(value, parser.getText(), OMNode.TEXT_NODE, true);
- } else if (token == XMLStreamReader.CDATA) {
- factory.createOMText(value, parser.getText(), OMNode.TEXT_NODE, true);
- } else {
- throw new SOAPProcessingException(
- "Only Characters are allowed here");
- }
- token = parser.next();
- }
-
-
- } catch (XMLStreamException e) {
- throw new SOAPProcessingException(e);
- }
- }
-
}
\ No newline at end of file
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java?rev=1356862&r1=1356861&r2=1356862&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java Tue Jul 3 18:24:36 2012
@@ -529,14 +529,4 @@ public class StAXSOAPModelBuilder extend
protected SOAPFactoryEx getSoapFactory() {
return soapFactory;
}
-
- /**
- * Increase or decrease the element level by the desired amount.
- * This is needed by the SOAP11BuilderHelper to account for the different
- * depths for the SOAP fault sytax.
- * @param value
- */
- void adjustElementLevel(int value) {
- elementLevel = elementLevel + value;
- }
}
Added: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/resources/soap/soap11/faultstring-with-comment.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/resources/soap/soap11/faultstring-with-comment.xml?rev=1356862&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/resources/soap/soap11/faultstring-with-comment.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/resources/soap/soap11/faultstring-with-comment.xml Tue Jul 3 18:24:36 2012
@@ -0,0 +1,8 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <SOAP-ENV:Fault>
+ <faultcode>SOAP-ENV:MustUnderstand</faultcode>
+ <faultstring><!-- some comment -->SOAP Must Understand Error</faultstring>
+ </SOAP-ENV:Fault>
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
\ No newline at end of file
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/test/resources/soap/soap11/faultstring-with-comment.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java?rev=1356862&r1=1356861&r2=1356862&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/SOAPTestSuiteBuilder.java Tue Jul 3 18:24:36 2012
@@ -27,11 +27,13 @@ import org.apache.axiom.testutils.suite.
public class SOAPTestSuiteBuilder extends TestSuiteBuilder {
private static final String[] badSOAPFiles = { "wrongSoapNs.xml", "notnamespaceQualified.xml", "soap11/twoheaders.xml", "soap11/twoBodymessage.xml",
- "soap11/envelopeMissing.xml", "soap11/haederBodyWrongOrder.xml" };
+ "soap11/envelopeMissing.xml", "soap11/haederBodyWrongOrder.xml", "soap11/invalid-faultcode.xml", "soap11/invalid-faultstring.xml",
+ "soap11/invalid-faultactor.xml" };
private static final String[] goodSOAPFiles = { TestConstants.WHITESPACE_MESSAGE,
TestConstants.MINIMAL_MESSAGE, TestConstants.REALLY_BIG_MESSAGE,
- TestConstants.EMPTY_BODY_MESSAGE, "soap/soap11/soapfault.xml", "soap/soap11/bodyNotQualified.xml" };
+ TestConstants.EMPTY_BODY_MESSAGE, "soap/soap11/soapfault.xml", "soap/soap11/bodyNotQualified.xml",
+ "soap/soap11/faultstring-with-comment.xml"};
private static final QName[] qnames = {
new QName("root"),
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/OMTestUtils.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/OMTestUtils.java?rev=1356862&r1=1356861&r2=1356862&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/OMTestUtils.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap/builder/OMTestUtils.java Tue Jul 3 18:24:36 2012
@@ -25,15 +25,10 @@ import java.util.Iterator;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNode;
-import org.apache.axiom.soap.SOAPFaultCode;
-import org.apache.axiom.soap.SOAPFaultReason;
public class OMTestUtils {
public static void walkThrough(OMElement element) {
- // TODO: SOAP11BuilderHelper handles fault codes and fault strings in a special way (it eagerly loads the content); check if there is a good reason to do so
- if (!(element instanceof SOAPFaultCode) && !(element instanceof SOAPFaultReason)) {
- Assert.assertFalse("Expected " + element.getQName() + " to be incomplete", element.isComplete());
- }
+ Assert.assertFalse("Expected " + element.getQName() + " to be incomplete", element.isComplete());
for (Iterator it = element.getAllAttributes(); it.hasNext(); ) {
Assert.assertNotNull(it.next());
}
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultactor.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultactor.xml?rev=1356862&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultactor.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultactor.xml Tue Jul 3 18:24:36 2012
@@ -0,0 +1,9 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <SOAP-ENV:Fault>
+ <faultcode>SOAP-ENV:MustUnderstand</faultcode>
+ <faultstring>SOAP Must Understand Error</faultstring>
+ <faultactor><invalid/></faultactor>
+ </SOAP-ENV:Fault>
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
\ No newline at end of file
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultactor.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultcode.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultcode.xml?rev=1356862&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultcode.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultcode.xml Tue Jul 3 18:24:36 2012
@@ -0,0 +1,8 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <SOAP-ENV:Fault>
+ <faultcode>SOAP-ENV:MustUnderstand<invalid/></faultcode>
+ <faultstring>SOAP Must Understand Error</faultstring>
+ </SOAP-ENV:Fault>
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
\ No newline at end of file
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultcode.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultstring.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultstring.xml?rev=1356862&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultstring.xml (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultstring.xml Tue Jul 3 18:24:36 2012
@@ -0,0 +1,8 @@
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <SOAP-ENV:Fault>
+ <faultcode>SOAP-ENV:MustUnderstand</faultcode>
+ <faultstring><invalid/></faultstring>
+ </SOAP-ENV:Fault>
+ </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
\ No newline at end of file
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/resources/badsoap/soap11/invalid-faultstring.xml
------------------------------------------------------------------------------
svn:eol-style = native