statesystem: Remove duplicate empty state creation
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 8 Sep 2014 21:00:54 +0000 (17:00 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 6 Oct 2014 20:15:02 +0000 (16:15 -0400)
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 <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/33076
Tested-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
org.eclipse.linuxtools.statesystem.core/src/org/eclipse/linuxtools/internal/statesystem/core/AttributeTree.java

index 96f15267f375afb80eee5728bd4fddd1d6cab411..965d70272e1f39a718a4ef1b765e2973db5f7288 100644 (file)
 
 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
This page took 0.026469 seconds and 5 git commands to generate.