Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDawid Pakuła2014-07-20 15:39:53 +0000
committerDawid Pakuła2014-11-08 19:07:45 +0000
commita83d0529e444d710abce46cc09f65a2f11007e39 (patch)
tree11e0f633fecf0f54a2a5639237032ef8d236bcca
parent561c932ae7838ec53a16764c33f8efc572037ffe (diff)
downloadorg.eclipse.dltk.core-a83d0529e444d710abce46cc09f65a2f11007e39.tar.gz
org.eclipse.dltk.core-a83d0529e444d710abce46cc09f65a2f11007e39.tar.xz
org.eclipse.dltk.core-a83d0529e444d710abce46cc09f65a2f11007e39.zip
Bug 439959 - H2 DeleteDBFiles not work after upgrade from juno
Signed-off-by: Dawid Pakuła <zulus@w3des.net>
-rw-r--r--core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2DbFactory.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2DbFactory.java b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2DbFactory.java
index 2f609a5e0..3453d9e86 100644
--- a/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2DbFactory.java
+++ b/core/plugins/org.eclipse.dltk.core.index.sql.h2/src/org/eclipse/dltk/internal/core/index/sql/h2/H2DbFactory.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.eclipse.dltk.internal.core.index.sql.h2;
+import java.io.File;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
@@ -98,7 +99,18 @@ public class H2DbFactory extends DbFactory {
// remove corrupted DB
try {
- DeleteDbFiles.execute(dbPath.toOSString(), DB_NAME, true);
+ if (tries == 1) { // try force delete
+ File folder = new File(dbPath.toOSString());
+ for (File f : folder.listFiles()) {
+ if (f.getName().startsWith(DB_NAME + ".")) { //$NON-NLS-1$
+ f.delete();
+ }
+ }
+ initializeSchema = true;
+ } else {
+ DeleteDbFiles.execute(dbPath.toOSString(), DB_NAME,
+ true);
+ }
} catch (Exception e1) {
SqlIndex.error(
@@ -107,7 +119,7 @@ public class H2DbFactory extends DbFactory {
throw e1;
}
}
- } while (connection == null && --tries > 0);
+ } while (connection == null && --tries >= 0);
}
/**

Back to the top