You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ru...@apache.org on 2005/08/05 10:42:00 UTC

svn commit: r230413 - in /webservices/axis/trunk/java/modules/core: src/org/apache/axis2/transport/http/HTTPTransportUtils.java test/org/apache/axis2/transport/http/HTTPTransportUtilTest.java

Author: ruchithf
Date: Fri Aug  5 01:41:42 2005
New Revision: 230413

URL: http://svn.apache.org/viewcvs?rev=230413&view=rev
Log:
corrected the typo in getCharSetEncoding method in HTTPTransportUtils and fixed a bug to return the default encoding when its not available in the content-type header

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
    webservices/axis/trunk/java/modules/core/test/org/apache/axis2/transport/http/HTTPTransportUtilTest.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java?rev=230413&r1=230412&r2=230413&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPTransportUtils.java Fri Aug  5 01:41:42 2005
@@ -118,7 +118,7 @@
                             MessageContext.DEFAULT_CHAR_SET_ENCODING);
                     } else {
                         //get the type of char encoding
-                        String charSetEnc = getCharSetEncoing(contentType);
+                        String charSetEnc = getCharSetEncoding(contentType);
                         xmlreader =
                             XMLInputFactory
                                 .newInstance()
@@ -215,8 +215,13 @@
      * Content-Type: text/xml; charset=utf-8 
      * @param contentType
      */
-    private static String getCharSetEncoing(String contentType) {
+    private static String getCharSetEncoding(String contentType) {
         int index = contentType.indexOf(HTTPConstants.CHAR_SET_ENCODING);
+        if(index == -1) { //Charset encoding not found in the contect-type header
+        	//Using the default UTF-8
+        	return MessageContext.DEFAULT_CHAR_SET_ENCODING;
+        }
+        
         //If there are spaces around the '=' sign
         int indexOfEq = contentType.indexOf("=", index);
         String value =
@@ -326,7 +331,7 @@
                 fileCacheForAttachments,
                 attachmentRepoDir);
         
-        String charSetEnc = getCharSetEncoing(contentTypeString);
+        String charSetEnc = getCharSetEncoding(contentTypeString);
         
         XMLStreamReader reader = XMLInputFactory.newInstance()
 				.createXMLStreamReader(

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis2/transport/http/HTTPTransportUtilTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis2/transport/http/HTTPTransportUtilTest.java?rev=230413&r1=230412&r2=230413&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis2/transport/http/HTTPTransportUtilTest.java (original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis2/transport/http/HTTPTransportUtilTest.java Fri Aug  5 01:41:42 2005
@@ -49,7 +49,7 @@
         element11.addChild(optimizedText);
         assertTrue(
                 "optmization check has not performed correctly in SOAPEnvelope",
-                httpTransportUtils.checkEnvelopeForOptimise(soapEnvelope));
+                HTTPTransportUtils.checkEnvelopeForOptimise(soapEnvelope));
     }
 
     public void testNonOptimizedEnvelope() {
@@ -63,7 +63,7 @@
         element11.addChild(optimizedText);
         assertFalse(
                 "optmization check has not performed correctly in SOAPEnvelope",
-                httpTransportUtils.checkEnvelopeForOptimise(soapEnvelope));
+                HTTPTransportUtils.checkEnvelopeForOptimise(soapEnvelope));
     }