axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kei...@apache.org
Subject svn commit: r504522 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: transport/http/AxisServlet.java transport/http/util/RESTUtil.java util/SchemaUtil.java
Date Wed, 07 Feb 2007 12:13:54 GMT
Author: keithc
Date: Wed Feb  7 04:13:53 2007
New Revision: 504522

URL: http://svn.apache.org/viewvc?view=rev&rev=504522
Log:
Fixing Nulpointer in axisservlet when in-only message is sent.
Fixing RestUtil to handle nonURLencoded data


Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=504522&r1=504521&r2=504522
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
Wed Feb  7 04:13:53 2007
@@ -327,7 +327,10 @@
         }
         if (closeReader) {
             try {
-                ((StAXBuilder) msgContext.getEnvelope().getBuilder()).close();
+                StAXBuilder builder = (StAXBuilder) msgContext.getEnvelope().getBuilder();
+                if (builder != null) {
+                    builder.close();
+                }
             } catch (Exception e) {
                 log.debug(e);
                 throw new ServletException(e);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java?view=diff&rev=504522&r1=504521&r2=504522
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/util/RESTUtil.java
Wed Feb  7 04:13:53 2007
@@ -272,7 +272,6 @@
                             contentType)) {
 
                 String charSetEnc = Builder.getCharSetEncoding(contentType);
-                XMLStreamReader xmlreader;
                 if (charSetEnc == null) {
                     // If charset is not specified
                     charSetEnc = MessageContext.DEFAULT_CHAR_SET_ENCODING;
@@ -282,8 +281,6 @@
 
                 // Create documentElement only if the content length is greator than 0
                 if (request.getContentLength() != 0) {
-                    xmlreader = StAXUtils.createXMLStreamReader(inputStream,
-                                                                charSetEnc);
                     OMBuilder builder = Builder.getPOXBuilder(inputStream, charSetEnc, null);
                     OMNodeEx documentElement = (OMNodeEx) builder.getDocumentElement();
                     documentElement.setParent(null);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java?view=diff&rev=504522&r1=504521&r2=504522
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/SchemaUtil.java
Wed Feb  7 04:13:53 2007
@@ -195,6 +195,11 @@
 
                             // check whether this has a mapping in httpLocationParameterMap.
                             String value = (String) httpLocationParameterMap.get(name);
+                            OMNamespace ns = (qName == null ||
+                                            qName.getNamespaceURI() == null
+                                            || qName.getNamespaceURI().length() == 0) ?
+                                            null : soapFactory.createOMNamespace(
+                                            qName.getNamespaceURI(), null);
                             if (value == null) {
                                 String[] parameterValuesArray =
                                         (String[]) requestParameterMap.get(name);
@@ -202,16 +207,15 @@
                                         !"".equals(parameterValuesArray[0]) &&
                                         parameterValuesArray[0] != null) {
                                     value = parameterValuesArray[0];
-                                    OMNamespace ns = (qName == null ||
-                                            qName.getNamespaceURI() == null
-                                            || qName.getNamespaceURI().length() == 0) ?
-                                            null : soapFactory.createOMNamespace(
-                                            qName.getNamespaceURI(), null);
+
                                     for (int i = 0 ; i < parameterValuesArray.length ;
i++) {
                                         soapFactory.createOMElement(name, ns,
                                                 bodyFirstChild).setText(parameterValuesArray[i]);
                                     }
                                 }
+                            } else {
+                                 soapFactory.createOMElement(name, ns,
+                                                bodyFirstChild).setText(value);
                             }
 
                             if (value == null) {
@@ -223,12 +227,6 @@
                                             Constants.NS_PREFIX_SCHEMA_XSI);
                                     OMAttribute omAttribute =
                                             soapFactory.createOMAttribute("nil", xsi, "true");
-                                    OMNamespace ns = (qName == null ||
-                                            qName.getNamespaceURI() == null ||
-                                            qName.getNamespaceURI().length() == 0) ?
-                                            null :
-                                            soapFactory.createOMNamespace(qName.getNamespaceURI(),
-                                                                          null);
                                     soapFactory.createOMElement(name, ns,
                                                                 bodyFirstChild)
                                             .addAttribute(omAttribute);
@@ -302,9 +300,10 @@
                 String parameterName = buffer.substring(0, buffer.indexOf("="));
                 String schemaElementName =
                         buffer.substring(buffer.indexOf("=") + 2, buffer.length() - 1);
-                String parameterValues = (String) parameterMap.get(parameterName);
-                if (parameterValues != null) {
-                    httpLocationParameterMap.put(schemaElementName, parameterValues);
+                String[] parameterValues = (String[]) parameterMap.get(parameterName);
+                String value;
+                if (parameterValues != null && (value =parameterValues[0]) != null)
{
+                    httpLocationParameterMap.put(schemaElementName, value);
                 }
             }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message