]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.acorn/src/org/simantics/acorn/lru/ClusterStreamChunk.java
NPE fix for Acorn cluster stream undo handling
[simantics/platform.git] / bundles / org.simantics.acorn / src / org / simantics / acorn / lru / ClusterStreamChunk.java
index 57d6f6a04b5d387c2c0b31ca2fd6cafab845dd4c..767746eb005864c2046a5e1b50237a1e03006030 100644 (file)
@@ -9,18 +9,20 @@ import org.simantics.acorn.ClusterManager;
 import org.simantics.acorn.Persistable;
 import org.simantics.acorn.exception.AcornAccessVerificationException;
 import org.simantics.acorn.exception.IllegalAcornStateException;
-import org.simantics.acorn.internal.ClusterChange;
 import org.simantics.acorn.internal.UndoClusterUpdateProcessor;
 import org.simantics.compressions.CompressionCodec;
 import org.simantics.compressions.Compressions;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.service.Bytes;
 import org.simantics.utils.datastructures.Pair;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import gnu.trove.list.array.TByteArrayList;
 
 public class ClusterStreamChunk extends LRUObject<String, ClusterStreamChunk> implements Persistable {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(ClusterStreamChunk.class);
        // 500KB is a fine chunk
        private static int MAX_CHUNK_SIZE = 500*1024;
 
@@ -57,8 +59,6 @@ public class ClusterStreamChunk extends LRUObject<String, ClusterStreamChunk> im
                if(op.ccs == null) throw new IllegalAcornStateException("Cluster ChangeSet " + ccsId + " was not found.");
 
                UndoClusterUpdateProcessor proc = new UndoClusterUpdateProcessor(clusters, this, op.ccs);
-               if(proc.version != ClusterChange.VERSION)
-                       return null;
 
                // This cluster and CCS can still be under preparation => wait
                clusters.clusterLRU.ensureUpdates(proc.getClusterUID());
@@ -296,5 +296,9 @@ public class ClusterStreamChunk extends LRUObject<String, ClusterStreamChunk> im
        protected boolean overwrite() {
                return false;
        }
-       
+
+       @Override
+       public Logger getLogger() {
+           return LOGGER;
+       }
 }
\ No newline at end of file