Author: klape
Date: 2011-08-12 12:01:03 -0400 (Fri, 12 Aug 2011)
New Revision: 14818
Modified:
thirdparty/cxf/branches/cxf-2.2.12/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
thirdparty/cxf/branches/cxf-2.2.12/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
thirdparty/cxf/branches/cxf-2.2.12/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
thirdparty/cxf/branches/cxf-2.2.12/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
Log:
[JBPAPP-6529] Fixing NPE in StaxUtils. Adding more GET checks.
Modified:
thirdparty/cxf/branches/cxf-2.2.12/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java 2011-08-12
15:19:03 UTC (rev 14817)
+++
thirdparty/cxf/branches/cxf-2.2.12/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java 2011-08-12
16:01:03 UTC (rev 14818)
@@ -97,11 +97,16 @@
}
public void handleMessage(SoapMessage message) throws Fault {
+ if (isGET(message)) {
+ return;
+ }
+
Boolean bodySet = (Boolean)message.get(BODY_FILLED_IN);
if (bodySet != null && bodySet == Boolean.TRUE) {
return;
}
message.put(BODY_FILLED_IN, Boolean.TRUE);
+
try {
MessageFactory factory = getFactory(message);
SOAPMessage soapMessage = factory.createMessage();
Modified:
thirdparty/cxf/branches/cxf-2.2.12/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java 2011-08-12
15:19:03 UTC (rev 14817)
+++
thirdparty/cxf/branches/cxf-2.2.12/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java 2011-08-12
16:01:03 UTC (rev 14818)
@@ -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.12/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java 2011-08-12
15:19:03 UTC (rev 14817)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java 2011-08-12
16:01:03 UTC (rev 14818)
@@ -57,6 +57,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;
@@ -86,8 +87,15 @@
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
+ }
+
public void testDocLitBare() throws Exception {
QName portName = new
QName("http://cxf.apache.org/systest/jaxws/DocLitBareCodeFirstServic...;,
"DocLitBareCodeFirstServicePort");
Modified:
thirdparty/cxf/branches/cxf-2.2.12/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java 2011-08-12
15:19:03 UTC (rev 14817)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ServerMisc.java 2011-08-12
16:01:03 UTC (rev 14818)
@@ -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;
@@ -82,7 +84,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);
@@ -107,6 +111,7 @@
Endpoint.publish("http://localhost:" + PORT +
"/InheritContext/InheritPort",
new InheritImpl());
+
}
public static void main(String[] args) {