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/03/22 17:55:19 UTC

svn commit: r387890 - /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java

Author: chinthaka
Date: Wed Mar 22 08:55:18 2006
New Revision: 387890

URL: http://svn.apache.org/viewcvs?rev=387890&view=rev
Log:
Fixing possible StringIndexOutOfBoundsException

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/util/Utils.java

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=387890&r1=387889&r2=387890&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 Wed Mar 22 08:55:18 2006
@@ -206,21 +206,23 @@
         if (-1 != index) {
             int serviceStart = index + Constants.REQUEST_URL_PREFIX.length();
 
-            service = path.substring(serviceStart + 1);
+            if (path.length() > serviceStart + 1) {
+                service = path.substring(serviceStart + 1);
 
-            int queryIndex = service.indexOf('?');
+                int queryIndex = service.indexOf('?');
 
-            if (queryIndex > 0) {
-                service = service.substring(0, queryIndex);
-            }
+                if (queryIndex > 0) {
+                    service = service.substring(0, queryIndex);
+                }
 
-            int operationIndex = service.indexOf('/');
+                int operationIndex = service.indexOf('/');
 
-            if (operationIndex > 0) {
-                values[0] = service.substring(0, operationIndex);
-                values[1] = service.substring(operationIndex + 1);
-            } else {
-                values[0] = service;
+                if (operationIndex > 0) {
+                    values[0] = service.substring(0, operationIndex);
+                    values[1] = service.substring(operationIndex + 1);
+                } else {
+                    values[0] = service;
+                }
             }
         }