From 6a4fd49261a53b42a252b27feb2c9f09af18ec89 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Thu, 17 May 2012 14:54:00 -0400 Subject: [PATCH] tmf: Correctly store null state values in the backend Signed-off-by: Alexandre Montplaisir --- .../backend/historytree/HTInterval.java | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/backend/historytree/HTInterval.java b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/backend/historytree/HTInterval.java index 677d6517df..f8fc536abe 100644 --- a/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/backend/historytree/HTInterval.java +++ b/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/backend/historytree/HTInterval.java @@ -171,19 +171,16 @@ final class HTInterval implements ITmfStateInterval, Comparable { 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 */ -- 2.34.1