From 085a78a823b932b441e0de4ec76cef6d47359ef6 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Mon, 8 Sep 2014 17:00:54 -0400 Subject: [PATCH] statesystem: Remove duplicate empty state creation The transient state already creates a "null" value for every state attribute that is added. No need for the attribute tree to do an explicit insertion immediately after (which gets ignored any way). That attribute tree should also keeps its paws off the transient state, but that's a different problem. Change-Id: Ib77e16d67375e65c495b9ff0b73c5cee78eddf02 Signed-off-by: Alexandre Montplaisir Reviewed-on: https://git.eclipse.org/r/33076 Tested-by: Hudson CI Reviewed-by: Patrick Tasse Tested-by: Patrick Tasse --- .../statesystem/core/AttributeTree.java | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/org.eclipse.linuxtools.statesystem.core/src/org/eclipse/linuxtools/internal/statesystem/core/AttributeTree.java b/org.eclipse.linuxtools.statesystem.core/src/org/eclipse/linuxtools/internal/statesystem/core/AttributeTree.java index 96f15267f3..965d70272e 100644 --- a/org.eclipse.linuxtools.statesystem.core/src/org/eclipse/linuxtools/internal/statesystem/core/AttributeTree.java +++ b/org.eclipse.linuxtools.statesystem.core/src/org/eclipse/linuxtools/internal/statesystem/core/AttributeTree.java @@ -12,16 +12,19 @@ package org.eclipse.linuxtools.internal.statesystem.core; -import java.io.*; +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.RandomAccessFile; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.linuxtools.statesystem.core.exceptions.AttributeNotFoundException; -import org.eclipse.linuxtools.statesystem.core.exceptions.StateValueTypeException; -import org.eclipse.linuxtools.statesystem.core.exceptions.TimeRangeException; -import org.eclipse.linuxtools.statesystem.core.statevalue.TmfStateValue; /** * The Attribute Tree is the /proc-like filesystem used to organize attributes. @@ -291,26 +294,7 @@ public final class AttributeTree { } prevNode = nextNode; } - /* - * Insert an initial null value for this attribute in the state - * system (in case the state provider doesn't set one). - */ - final int newAttrib = attributeList.size() - 1; - try { - ss.modifyAttribute(ss.getStartTime(), TmfStateValue.nullValue(), newAttrib); - } catch (TimeRangeException e) { - /* Should not happen, we're inserting at ss's start time */ - throw new IllegalStateException(e); - } catch (AttributeNotFoundException e) { - /* Should not happen, we just created this attribute! */ - throw new IllegalStateException(e); - } catch (StateValueTypeException e) { - /* Should not happen, there is no existing state value, and the - * one we insert is a null value anyway. */ - throw new IllegalStateException(e); - } - - return newAttrib; + return attributeList.size() - 1; } /* * The attribute was already existing, return the quark of that -- 2.34.1