Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-03-07 07:43:59 -0500
committerEike Stepper2013-03-07 08:45:14 -0500
commit549c7bf0b7c58f0cd49eab63149dd79654f1451e (patch)
tree7935f70bc8552699aa514bf3c16f4f00ae5e27b1
parentc24c0fbffac8c9c51ff49172b1104fbd8b6b460e (diff)
downloadcdo-549c7bf0b7c58f0cd49eab63149dd79654f1451e.tar.gz
cdo-549c7bf0b7c58f0cd49eab63149dd79654f1451e.tar.xz
cdo-549c7bf0b7c58f0cd49eab63149dd79654f1451e.zip
[401763] Make CDO Server more robust against data dictionary changes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=401763
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/IDBSchemaVisitor.java14
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/delta/IDBDeltaVisitor.java39
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBSchemaElement.java11
3 files changed, 61 insertions, 3 deletions
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/IDBSchemaVisitor.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/IDBSchemaVisitor.java
index ec3d5286d1..c1bf6751a0 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/IDBSchemaVisitor.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/IDBSchemaVisitor.java
@@ -10,7 +10,6 @@
*/
package org.eclipse.net4j.db.ddl;
-
/**
* @since 4.2
* @author Eike Stepper
@@ -30,6 +29,14 @@ public interface IDBSchemaVisitor
/**
* @author Eike Stepper
*/
+ public static final class StopRecursion extends RuntimeException
+ {
+ private static final long serialVersionUID = 1L;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
public static class Default implements IDBSchemaVisitor
{
public void visit(IDBSchema element)
@@ -61,5 +68,10 @@ public interface IDBSchemaVisitor
{
visitDefault(element);
}
+
+ protected final void stopRecursion()
+ {
+ throw new StopRecursion();
+ }
}
}
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/delta/IDBDeltaVisitor.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/delta/IDBDeltaVisitor.java
index e63aa1d820..82a8092411 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/delta/IDBDeltaVisitor.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ddl/delta/IDBDeltaVisitor.java
@@ -47,6 +47,14 @@ public interface IDBDeltaVisitor
/**
* @author Eike Stepper
*/
+ public static final class StopRecursion extends RuntimeException
+ {
+ private static final long serialVersionUID = 1L;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
public static class Default implements IDBDeltaVisitor
{
public void visit(IDBSchemaDelta delta)
@@ -72,6 +80,10 @@ public interface IDBDeltaVisitor
illegalChangeKind(changeKind);
}
}
+ else
+ {
+ stopRecursion();
+ }
}
protected void added(IDBSchemaDelta delta)
@@ -112,6 +124,10 @@ public interface IDBDeltaVisitor
illegalChangeKind(changeKind);
}
}
+ else
+ {
+ stopRecursion();
+ }
}
protected void added(IDBTableDelta delta)
@@ -152,6 +168,10 @@ public interface IDBDeltaVisitor
illegalChangeKind(changeKind);
}
}
+ else
+ {
+ stopRecursion();
+ }
}
protected void added(IDBFieldDelta delta)
@@ -192,6 +212,10 @@ public interface IDBDeltaVisitor
illegalChangeKind(changeKind);
}
}
+ else
+ {
+ stopRecursion();
+ }
}
protected void added(IDBIndexDelta delta)
@@ -232,6 +256,10 @@ public interface IDBDeltaVisitor
illegalChangeKind(changeKind);
}
}
+ else
+ {
+ stopRecursion();
+ }
}
protected void added(IDBIndexFieldDelta delta)
@@ -272,6 +300,10 @@ public interface IDBDeltaVisitor
illegalChangeKind(changeKind);
}
}
+ else
+ {
+ stopRecursion();
+ }
}
protected void added(IDBPropertyDelta<?> delta)
@@ -299,6 +331,11 @@ public interface IDBDeltaVisitor
return true;
}
+ protected final void stopRecursion()
+ {
+ throw new StopRecursion();
+ }
+
private void illegalChangeKind(ChangeKind changeKind)
{
throw new IllegalStateException("Illegal change kind: " + changeKind);
@@ -477,7 +514,7 @@ public interface IDBDeltaVisitor
}
@Override
- protected boolean handle(IDBDelta delta)
+ protected final boolean handle(IDBDelta delta)
{
Boolean deltaPolicy = policy.get(delta.getChangeKind());
if (deltaPolicy == FORBIDDEN)
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBSchemaElement.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBSchemaElement.java
index 4c362326d4..c421770e7a 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBSchemaElement.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/spi/db/DBSchemaElement.java
@@ -12,6 +12,7 @@ package org.eclipse.net4j.spi.db;
import org.eclipse.net4j.db.ddl.IDBSchemaElement;
import org.eclipse.net4j.db.ddl.IDBSchemaVisitor;
+import org.eclipse.net4j.db.ddl.IDBSchemaVisitor.StopRecursion;
import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.collection.PositionProvider;
@@ -99,7 +100,15 @@ public abstract class DBSchemaElement extends DBNamedElement implements IDBSchem
public final void accept(IDBSchemaVisitor visitor)
{
- doAccept(visitor);
+ try
+ {
+ doAccept(visitor);
+ }
+ catch (StopRecursion ex)
+ {
+ return;
+ }
+
for (IDBSchemaElement element : getElements())
{
element.accept(visitor);

Back to the top