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 ch...@apache.org on 2006/01/25 05:17:36 UTC
svn commit: r372100 - in
/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2:
engine/AddressingBasedDispatcher.java
transport/http/HTTPTransportUtils.java util/Utils.java
Author: chinthaka
Date: Tue Jan 24 20:17:25 2006
New Revision: 372100
URL: http://svn.apache.org/viewcvs?rev=372100&view=rev
Log:
Preventing (some more) NPE.
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java?rev=372100&r1=372099&r2=372100&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java Tue Jan 24 20:17:25 2006
@@ -38,9 +38,9 @@
*/
public class AddressingBasedDispatcher extends AbstractDispatcher implements AddressingConstants {
- private static final long serialVersionUID = 8294130617631587374L;
-
- /**
+ private static final long serialVersionUID = 8294130617631587374L;
+
+ /**
* Field NAME
*/
public static final QName NAME = new QName("http://ws.apache.org/axis2/",
@@ -64,6 +64,7 @@
// TODO this logic needed to be improved, as the Dispatching is almost guaranteed to fail
public AxisService findService(MessageContext messageContext) throws AxisFault {
EndpointReference toEPR = messageContext.getTo();
+
AxisService service = null;
if (toEPR != null) {
@@ -76,8 +77,11 @@
return null;
}
- QName serviceName = new QName(address);
+ QName serviceName;
String[] values = Utils.parseRequestURLForServiceAndOperation(address);
+ if (values == null) {
+ return null;
+ }
log.debug("Checking for Service using toEPR : " + values[0]);
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java?rev=372100&r1=372099&r2=372100&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java Tue Jan 24 20:17:25 2006
@@ -62,6 +62,10 @@
public static SOAPEnvelope createEnvelopeFromGetRequest(String requestUrl, Map map) {
String[] values = Utils.parseRequestURLForServiceAndOperation(requestUrl);
+ if (values == null) {
+ return new SOAP11Factory().getDefaultEnvelope();
+ }
+
if ((values[1] != null) && (values[0] != null)) {
String operation = values[1];
SOAPFactory soapFactory = new SOAP11Factory();
@@ -94,13 +98,13 @@
if (msgContext.getParameter(Constants.Configuration.ENABLE_MTOM) != null) {
enableMTOM = Constants.VALUE_TRUE.equals(
msgContext.getParameter(Constants.Configuration.ENABLE_MTOM).getValue());
- }
-
+ }
+
if (msgContext.getProperty(Constants.Configuration.ENABLE_MTOM) != null) {
enableMTOM = Constants.VALUE_TRUE.equals(
msgContext.getProperty(Constants.Configuration.ENABLE_MTOM));
}
-
+
boolean forceMIME =
Constants.VALUE_TRUE.equals(msgContext.getProperty(Constants.Configuration.FORCE_MIME));
@@ -109,10 +113,10 @@
}
// If MTOM is explicitly disabled, no need to check the envelope
- if(!enableMTOM) {
+ if (!enableMTOM) {
return false;
}
-
+
boolean envelopeContainsOptimise =
HTTPTransportUtils.checkEnvelopeForOptimise(msgContext.getEnvelope());
@@ -246,7 +250,7 @@
}
String charsetEncoding = builder.getDocument().getCharsetEncoding();
-
+
if ((charsetEncoding != null) && !"".equals(charsetEncoding)
&& ! charsetEncoding.equalsIgnoreCase((String) msgContext.getProperty(
MessageContext.CHARACTER_SET_ENCODING))) {
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java?rev=372100&r1=372099&r2=372100&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java Tue Jan 24 20:17:25 2006
@@ -162,6 +162,9 @@
* the path after the first element. all ? parameters are discarded.
*/
public static String[] parseRequestURLForServiceAndOperation(String path) {
+ if (path == null) {
+ return null;
+ }
String[] values = new String[2];
// TODO. This is kind of brittle. Any service with the name /services would cause fun.
@@ -201,10 +204,10 @@
}
File axis2xml = new File(file, "axis.xml");
String axis2xmlString = null;
- if(axis2xml.exists()){
+ if (axis2xml.exists()) {
axis2xmlString = axis2xml.getName();
}
- return ConfigurationContextFactory.createConfigurationContextFromFileSystem(file.getAbsolutePath(),axis2xmlString);
+ return ConfigurationContextFactory.createConfigurationContextFromFileSystem(file.getAbsolutePath(), axis2xmlString);
}
public static String getParameterValue(Parameter param) {
@@ -243,9 +246,9 @@
public static QName getModuleName(String name, String versionID) {
- String moduleName ;
- if(versionID!=null && !versionID.equals("")){
- moduleName = name + "-" + versionID;
+ String moduleName;
+ if (versionID != null && !versionID.equals("")) {
+ moduleName = name + "-" + versionID;
} else {
moduleName = name;
}