tmf: Correctly store null state values in the backend
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 17 May 2012 18:54:00 +0000 (14:54 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Thu, 17 May 2012 18:54:00 +0000 (14:54 -0400)
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/backend/historytree/HTInterval.java

index 677d6517df4352687789e7b2ebc825cc1da8da48..f8fc536abe512fd28ebc5c01d24f1efa63b0a779 100644 (file)
@@ -171,19 +171,16 @@ final class HTInterval implements ITmfStateInterval, Comparable<HTInterval> {
         byteArrayToWrite = sv.toByteArray();
 
         if (byteArrayToWrite == null) {
-            /* We write the 'valueOffset' field as a straight value */
-            if (sv.isNull()) {
-                buffer.putInt(0);
-            } else {
-                try {
-                    buffer.putInt(sv.unboxInt());
-                } catch (StateValueTypeException e) {
-                    /*
-                     * This should not happen, since the value told us it was of
-                     * type Integer (corrupted value?)
-                     */
-                    e.printStackTrace();
-                }
+            /* We write the 'valueOffset' field as a straight value. In the case
+             * of a null value, it will be unboxed as -1 */
+            try {
+                buffer.putInt(sv.unboxInt());
+            } catch (StateValueTypeException e) {
+                /*
+                 * This should not happen, since the value told us it was of
+                 * type Null or Integer (corrupted value?)
+                 */
+                e.printStackTrace();
             }
             return 0; /* we didn't use a Strings section entry */
 
This page took 0.040183 seconds and 5 git commands to generate.