releng: Add SWTBot integration tests
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.statesystem.core / src / org / eclipse / tracecompass / internal / statesystem / core / backend / historytree / HistoryTreeClassic.java
index 54b8793543aa4e9fe78254e33ec4851b135b8bb8..461fbf6eb22ab0a0fdef1de3fc817cba7759e2e3 100644 (file)
@@ -22,6 +22,7 @@ import java.nio.ByteOrder;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.FileChannel;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
@@ -140,10 +141,14 @@ public class HistoryTreeClassic implements IHistoryTree {
                 FileChannel fc = fis.getChannel();) {
 
             ByteBuffer buffer = ByteBuffer.allocate(TREE_HEADER_SIZE);
-
             buffer.order(ByteOrder.LITTLE_ENDIAN);
             buffer.clear();
-            fc.read(buffer);
+
+            res = fc.read(buffer);
+            if (res != TREE_HEADER_SIZE) {
+                throw new IOException("Invalid header size"); //$NON-NLS-1$
+            }
+
             buffer.flip();
 
             /*
@@ -589,7 +594,7 @@ public class HistoryTreeClassic implements IHistoryTree {
     }
 
     @Override
-    public HTNode selectNextChild(CoreNode currentNode, long t) throws ClosedChannelException {
+    public Collection<HTNode> selectNextChildren(CoreNode currentNode, long t) throws ClosedChannelException {
         assert (currentNode.getNbChildren() > 0);
         int potentialNextSeqNb = currentNode.getSequenceNumber();
 
@@ -615,9 +620,9 @@ public class HistoryTreeClassic implements IHistoryTree {
          * node has to be on disk
          */
         if (currentNode.isOnDisk()) {
-            return fTreeIO.readNode(potentialNextSeqNb);
+            return Collections.singleton(fTreeIO.readNode(potentialNextSeqNb));
         }
-        return readNode(potentialNextSeqNb);
+        return Collections.singleton(readNode(potentialNextSeqNb));
     }
 
     @Override
This page took 0.029763 seconds and 5 git commands to generate.