db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r989036 - /db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/planexporter/AccessDatabase.java
Date Wed, 25 Aug 2010 12:04:17 GMT
Author: kahatlen
Date: Wed Aug 25 12:04:17 2010
New Revision: 989036

URL: http://svn.apache.org/viewvc?rev=989036&view=rev
Log:
DERBY-4781: suites.All fails completely with Failed to invoke suite():java.lang.reflect.InvocationTargetException
because of XplainStatisticsTest

Fixed replace() method. The old version would sometimes erroneously
return an empty string.

Patch contributed by Nirmal Fernando <nirmal070125@gmail.com>.

Modified:
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/planexporter/AccessDatabase.java

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/planexporter/AccessDatabase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/planexporter/AccessDatabase.java?rev=989036&r1=989035&r2=989036&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/planexporter/AccessDatabase.java
(original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/planexporter/AccessDatabase.java
Wed Aug 25 12:04:17 2010
@@ -460,15 +460,13 @@ public class AccessDatabase {
      * @return modified string
      */
     private String replace(String stmt, String expr, String replace){
-    	if(stmt.indexOf(expr)!=-1){
-    		stmt=stmt.substring(0, stmt.indexOf(expr))
-    		+replace+stmt.substring(stmt.indexOf(expr)+1);
-    		replace(stmt,expr,replace);
-    		return "";
-    	}
-    	else{
-    		return stmt;
-    	}
+    	 int idx = stmt.indexOf(expr);
+    	 while (idx >= 0)
+    	 {
+    	   stmt = stmt.substring(0, idx) + replace + stmt.substring(idx+1);
+    	   idx = stmt.indexOf(expr);
+    	 }
+    	 return stmt;
     }
    
     /**



Mime
View raw message