db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r499200 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/jvm.java
Date Wed, 24 Jan 2007 00:54:03 GMT
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;
 	}
 



Mime
View raw message