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=b84d4d51fe84fef82e1dc1f8a63fdb817cf3c82b;hp=726071dbecd3c5d5521ba457481dfffc83efaa43;hb=d9a9d77c7024260e3e3b3a8558ddc84b2a8b99b3;hpb=0144ba232323a0e4f7ec8fe0681a150faafd7caf 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..b84d4d51f 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 @@ -16,15 +16,16 @@ import java.io.IOException; import java.io.InputStream; import java.util.Arrays; +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; @@ -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 @@ -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!!"; + } } }