X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.acorn%2Fsrc%2Forg%2Fsimantics%2Facorn%2Fcluster%2FClusterSmall.java;h=117ab75a3fc723b66660cd48c6db6231b496a3d1;hp=726071dbecd3c5d5521ba457481dfffc83efaa43;hb=56a799c9b7d395cefb59e101cd0f7ce8d68f88e6;hpb=463c2a8dd4b9ca623872e6520906c19c03a1c4cb diff --git a/bundles/org.simantics.acorn/src/org/simantics/acorn/cluster/ClusterSmall.java b/bundles/org.simantics.acorn/src/org/simantics/acorn/cluster/ClusterSmall.java index 726071dbe..117ab75a3 100644 --- a/bundles/org.simantics.acorn/src/org/simantics/acorn/cluster/ClusterSmall.java +++ b/bundles/org.simantics.acorn/src/org/simantics/acorn/cluster/ClusterSmall.java @@ -15,16 +15,18 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; +import java.util.function.Consumer; +import org.simantics.acorn.exception.IllegalAcornStateException; import org.simantics.acorn.internal.ClusterChange; import org.simantics.acorn.internal.ClusterStream; import org.simantics.acorn.internal.ClusterSupport2; import org.simantics.acorn.internal.DebugPolicy; import org.simantics.db.Resource; +import org.simantics.db.common.utils.Logger; import org.simantics.db.exception.DatabaseException; import org.simantics.db.exception.ExternalValueException; import org.simantics.db.exception.ValidationException; -import org.simantics.db.impl.ClusterBase; import org.simantics.db.impl.ClusterI; import org.simantics.db.impl.ClusterSupport; import org.simantics.db.impl.ClusterTraitsBase; @@ -51,7 +53,6 @@ import org.simantics.db.procore.cluster.ValueTableSmall; import org.simantics.db.service.Bytes; import org.simantics.db.service.ClusterUID; import org.simantics.db.service.ResourceUID; -import org.simantics.utils.datastructures.Callback; import gnu.trove.map.hash.TIntShortHashMap; import gnu.trove.procedure.TIntProcedure; @@ -708,8 +709,7 @@ final public class ClusterSmall extends ClusterImpl { } } @Override - public byte[] getValue(int resourceKey, ClusterSupport support) - throws DatabaseException { + public byte[] getValue(int resourceKey, ClusterSupport support) throws DatabaseException { if (DEBUG) System.out.println("ClusterSmall.getValue " + resourceKey); int resourceIndex = ClusterTraitsBase.getResourceIndexFromResourceKeyNoThrow(resourceKey); @@ -838,12 +838,11 @@ final public class ClusterSmall extends ClusterImpl { return resourceTable.getUsedSize(); } - public int getNumberOfResources() { - - if(proxy) throw new IllegalStateException(); + public int getNumberOfResources() throws IllegalAcornStateException { + if(proxy) + throw new IllegalAcornStateException("proxy == true for " + clusterId); return resourceTable.getUsedSize(); - } @Override @@ -1019,7 +1018,7 @@ final public class ClusterSmall extends ClusterImpl { } @Override - public void load(Callback r) { + public void load(Consumer r) { throw new Error("Not supported."); } @@ -1134,7 +1133,13 @@ final public class ClusterSmall extends ClusterImpl { }); return "ClusterSmall[" + getClusterUID() + " - " + getClusterId() + " - " + getNumberOfResources() + " - " + foreignTable.getResourceHashMap().size() + " - " + set.size() + "]"; } catch (DatabaseException e) { - return "ClusterSmall[" + getNumberOfResources() + "]"; + try { + return "ClusterSmall[" + getNumberOfResources() + "]"; + } catch (IllegalAcornStateException e1) { + Logger.defaultLogError(e1); + e1.printStackTrace(); + return "An exception occured!!"; + } } } @@ -1270,7 +1275,7 @@ final public class ClusterSmall extends ClusterImpl { } @Override - public Table getForeignTable() { + public Table getForeignTable() { return foreignTable; }