Author: bmaxwell
Date: 2011-05-26 20:47:50 -0400 (Thu, 26 May 2011)
New Revision: 14446
Modified:
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
Log:
[JBPAPP-6615] backport CXF-3170 - NullPointerException in StaxUtils.java:961
Modified:
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java 2011-05-27
00:41:58 UTC (rev 14445)
+++
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java 2011-05-27
00:47:50 UTC (rev 14446)
@@ -96,6 +96,10 @@
}
public void handleMessage(SoapMessage message) throws Fault {
+ if (isGET(message)) {
+ return;
+ }
+
try {
MessageFactory factory = getFactory(message);
SOAPMessage soapMessage = factory.createMessage();
Modified:
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java 2011-05-27
00:41:58 UTC (rev 14445)
+++
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java 2011-05-27
00:47:50 UTC (rev 14446)
@@ -143,9 +143,13 @@
}
return result;
}
+ public final boolean isGET(SoapMessage message) {
+ String method = (String)message.get(SoapMessage.HTTP_REQUEST_METHOD);
+ return "GET".equals(method) &&
message.getContent(XMLStreamReader.class) == null;
+ }
public void handleMessage(SoapMessage msg) throws Fault {
- if (msg.containsKey(SECURITY_PROCESSED)) {
+ if (msg.containsKey(SECURITY_PROCESSED) || isGET(msg)) {
return;
}
msg.put(SECURITY_PROCESSED, Boolean.TRUE);
Modified:
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java 2011-05-27
00:41:58 UTC (rev 14445)
+++
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java 2011-05-27
00:47:50 UTC (rev 14446)
@@ -53,6 +53,7 @@
import org.apache.cxf.common.util.ASMHelper;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.helpers.XMLUtils;
import org.apache.cxf.helpers.XPathUtils;
import org.apache.cxf.jaxb_element_test.JaxbElementTest;
@@ -80,8 +81,100 @@
public static void startServers() throws Exception {
assertTrue("server did not launch correctly",
launchServer(ServerMisc.class));
}
-
@Test
+ public void testCXF3170() throws Exception {
+ URL url = new URL(ServerMisc.DOCLITBARE_CODEFIRST_URL + "/foo");
+ HttpURLConnection con = (HttpURLConnection)url.openConnection();
+ con.getResponseCode();
+ String str = IOUtils.readStringFromStream(con.getErrorStream());
+ assertTrue(str.contains("/foo")); //No such operation
+ }
+ @Test
+ public void testWSDLDocs() throws Exception {
+ Map<String, String> ns = new HashMap<String, String>();
+ ns.put("wsdl", WSDLConstants.NS_WSDL11);
+ XPathUtils xpu = new XPathUtils(ns);
+ Document wsdl =
XMLUtils.parse(this.getHttpConnection(ServerMisc.DOCLIT_CODEFIRST_URL +
"?wsdl")
+ .getInputStream());
+ //XMLUtils.printDOM(wsdl.getDocumentElement());
+ assertEquals("DocLitWrappedCodeFirstService impl",
+
xpu.getValue("/wsdl:definitions/wsdl:service/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("DocLitWrappedCodeFirstService interface",
+
xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("DocLitWrappedCodeFirstService top level doc",
+ xpu.getValue("/wsdl:definitions/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("DocLitWrappedCodeFirstService binding doc",
+
xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("DocLitWrappedCodeFirstService service/port doc",
+
xpu.getValue("/wsdl:definitions/wsdl:service/wsdl:port/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut doc",
+
xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:operation[@name='multiInOut']"
+ + "/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut Input doc",
+
xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:operation[@name='multiInOut']"
+ + "/wsdl:input/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut Output doc",
+
xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:operation[@name='multiInOut']"
+ + "/wsdl:output/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut InputMessage doc",
+
xpu.getValue("/wsdl:definitions/wsdl:message[@name='multiInOut']"
+ + "/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut OutputMessage doc",
+
xpu.getValue("/wsdl:definitions/wsdl:message[@name='multiInOutResponse']"
+ + "/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut binding doc",
+
xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='multiInOut']"
+ + "/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut binding Input doc",
+
xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='multiInOut']"
+ + "/wsdl:input/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("multiInOut binding Output doc",
+
xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='multiInOut']"
+ + "/wsdl:output/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("fault binding doc",
+
xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='throwException']"
+ + "/wsdl:fault/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("fault porttype doc",
+
xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:operation[@name='throwException']"
+ + "/wsdl:fault/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ assertEquals("fault message doc",
+
xpu.getValue("/wsdl:definitions/wsdl:message[@name='CustomException']"
+ + "/wsdl:documentation",
+ wsdl.getDocumentElement(),
+ XPathConstants.STRING));
+ }
+
+ @Test
public void testDocLitBare() throws Exception {
QName portName = new
QName("http://cxf.apache.org/systest/jaxws/DocLitBareCodeFirstServic...;,
"DocLitBareCodeFirstServicePort");
Modified:
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java 2011-05-27
00:41:58 UTC (rev 14445)
+++
thirdparty/cxf/branches/cxf-2.2.6-patch-01_JBPAPP-6615/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java 2011-05-27
00:47:50 UTC (rev 14446)
@@ -22,7 +22,9 @@
import javax.xml.ws.Endpoint;
import org.apache.cxf.anonymous_complex_type.AnonymousComplexTypeImpl;
+import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
import org.apache.cxf.jaxb_element_test.JaxbElementTestImpl;
+import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.jaxws.JAXWSMethodInvoker;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
import org.apache.cxf.ordered_param_holder.OrderedParamHolderImpl;
@@ -79,7 +81,9 @@
//Endpoint.publish(DOCLIT_CODEFIRST_URL, implementor4);
Object implementor7 = new DocLitBareCodeFirstServiceImpl();
- Endpoint.publish(DOCLITBARE_CODEFIRST_URL, implementor7);
+ EndpointImpl ep = (EndpointImpl)Endpoint.publish(DOCLITBARE_CODEFIRST_URL,
implementor7);
+ ep.getServer().getEndpoint().getInInterceptors().add(new SAAJInInterceptor());
+
Object implementor6 = new InterfaceInheritTestImpl();
Endpoint.publish(DOCLIT_CODEFIRST_BASE_URL, implementor6);
@@ -104,6 +108,7 @@
Endpoint.publish("http://localhost:9000/InheritContext/InheritPort",
new InheritImpl());
+
}
public static void main(String[] args) {