You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by my...@apache.org on 2007/01/24 01:54:03 UTC

svn commit: r499200 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/jvm.java

Author: myrnavl
Date: Tue Jan 23 16:54:02 2007
New Revision: 499200

URL: http://svn.apache.org/viewvc?view=rev&rev=499200
Log:
DERBY-2265 bad code in functionTests.harness.jvm.guessWSHome 
- prevented StringIndexOutOfBoundsException with j9

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/jvm.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/jvm.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/jvm.java?view=diff&rev=499200&r1=499199&r2=499200
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/jvm.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/jvm.java Tue Jan 23 16:54:02 2007
@@ -298,8 +298,17 @@
 		String sep = System.getProperty("file.separator");
 		// need to strip off the java directory  assuming it's something
 		// like ibm14/jre or ibm14
-		wshome = jhome.substring(0,jhome.indexOf(sep + "jre"));
-		wshome = wshome.substring(0,wshome.lastIndexOf(sep));
+		int havejre=jhome.indexOf(sep + "jre");
+		if (havejre > 0)
+		{
+			wshome = jhome.substring(0,jhome.indexOf(sep + "jre"));
+			if (wshome.lastIndexOf(sep) >= 0)
+				wshome = wshome.substring(0,wshome.lastIndexOf(sep));
+		}
+		{
+			if (jhome.lastIndexOf(sep) >= 0)
+				wshome = jhome.substring(0,jhome.lastIndexOf(sep));	
+		}
 		return wshome;
 	}