ss: Replace AttributeNotFoundException with IOOBE for quark parameters
authorPatrick Tasse <patrick.tasse@gmail.com>
Fri, 6 May 2016 15:00:29 +0000 (11:00 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Wed, 18 May 2016 21:09:50 +0000 (17:09 -0400)
Methods that take a quark integer as parameter are changed to throw a
runtime IndexOutOfBoundsException instead of a checked
AttributeNotFoundException.

This makes those methods consistent with other methods that already
throw IOOBE when the quark is out of range.

Many occurrences were already swallowing the exception or re-throwing a
runtime exception.

Change-Id: I943b407e07bbc226c6b7c03306cd6d00f783bca2
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/72198
Reviewed-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-by: Hudson CI
39 files changed:
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/kernel/KernelThreadInformationProvider.java
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/tid/ActiveTidStateProvider.java
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/analysis/os/linux/core/tid/TidAnalysisModule.java
analysis/org.eclipse.tracecompass.analysis.os.linux.core/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/inputoutput/DiskWriteModel.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/controlflow/ControlFlowView.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/kernelmemoryusage/KernelMemoryUsageTreeViewer.java
lttng/org.eclipse.tracecompass.lttng2.kernel.core.tests/perf/org/eclipse/tracecompass/lttng2/kernel/core/tests/perf/analysis/tid/TidAnalysisUsageBenchmark.java
lttng/org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/internal/lttng2/kernel/core/analysis/vm/module/VirtualMachineStateProvider.java
lttng/org.eclipse.tracecompass.lttng2.kernel.ui/src/org/eclipse/tracecompass/internal/lttng2/kernel/ui/views/vm/vcpuview/VirtualMachineView.java
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/internal/lttng2/ust/core/analysis/memory/UstMemoryStateProvider.java
lttng/org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/analysis/debuginfo/UstDebugInfoAnalysisModule.java
statesystem/org.eclipse.tracecompass.statesystem.core.tests/src/org/eclipse/tracecompass/statesystem/core/tests/StateSystemPushPopTest.java
statesystem/org.eclipse.tracecompass.statesystem.core.tests/src/org/eclipse/tracecompass/statesystem/core/tests/StateSystemUtilsTest.java
statesystem/org.eclipse.tracecompass.statesystem.core.tests/src/org/eclipse/tracecompass/statesystem/core/tests/backend/InMemoryBackendTest.java
statesystem/org.eclipse.tracecompass.statesystem.core.tests/src/org/eclipse/tracecompass/statesystem/core/tests/backend/StateHistoryBackendTestBase.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/AttributeTree.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/StateSystem.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/TransientState.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/internal/statesystem/core/backend/InMemoryBackend.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/statesystem/core/ITmfStateSystem.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/statesystem/core/ITmfStateSystemBuilder.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/statesystem/core/StateSystemUtils.java
statesystem/org.eclipse.tracecompass.statesystem.core/src/org/eclipse/tracecompass/statesystem/core/backend/IStateHistoryBackend.java
tmf/org.eclipse.tracecompass.tmf.analysis.xml.core/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/core/model/TmfXmlScenarioHistoryBuilder.java
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java
tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/xychart/XmlXYViewer.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/statesystem/AttributePoolTest.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/statesystem/mipmap/TmfMipmapStateProviderStub.java
tmf/org.eclipse.tracecompass.tmf.core.tests/stubs/org/eclipse/tracecompass/tmf/tests/stubs/analysis/TestExperimentAnalysis.java
tmf/org.eclipse.tracecompass.tmf.core.tests/stubs/org/eclipse/tracecompass/tmf/tests/stubs/analysis/TestStateSystemProvider.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/statesystem/backends/partial/PartialHistoryBackend.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/statesystem/mipmap/AbstractTmfMipmapStateProvider.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/statesystem/mipmap/TmfMipmapFeature.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/callstack/CallStackStateProvider.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/event/aspect/TmfStateSystemAspect.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/TmfAttributePool.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackPresentationProvider.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/CallStackView.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/statesystem/TmfStateSystemViewer.java

index 0beb0e5c85f825771bed3983f00a4e3b141c7399..de0125ba18f46b30158989359cd4fcd593e0f41d 100644 (file)
@@ -189,7 +189,7 @@ public final class KernelThreadInformationProvider {
         }
         try {
             return ss.querySingleState(ts, prioQuark).getStateValue().unboxInt();
-        } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (StateSystemDisposedException e) {
             return -1;
         }
     }
index d9f9dee5ff1a0397d89a92a5c3a59e6f8690aabf..78a5ee7ac5840868ea660b4fdef4a71b528efeef 100644 (file)
@@ -17,7 +17,6 @@ import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEven
 import org.eclipse.tracecompass.common.core.NonNullUtils;
 import org.eclipse.tracecompass.internal.analysis.os.linux.core.Activator;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
@@ -90,7 +89,7 @@ class ActiveTidStateProvider extends AbstractTmfStateProvider {
             int nextTid = ((Long) event.getContent().getField(fNextTid).getValue()).intValue();
             final TmfStateValue value = TmfStateValue.newValueInt(nextTid);
             ssb.modifyAttribute(event.getTimestamp().toNanos(), value, cpuQuark);
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             Activator.getDefault().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e);
         }
     }
index cf261f4176c8c2cf2e888aeddee6cf2deaf53736..3745b4ccae4086d744b12e1f5c9c68c6abb0da66 100644 (file)
@@ -23,7 +23,6 @@ import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
 import org.eclipse.tracecompass.common.core.NonNullUtils;
 import org.eclipse.tracecompass.internal.analysis.os.linux.core.Activator;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
@@ -90,7 +89,7 @@ public class TidAnalysisModule extends TmfStateSystemAnalysisModule {
             if (value.getType().equals(Type.INTEGER)) {
                 tid = value.unboxInt();
             }
-        } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (StateSystemDisposedException e) {
             Activator.getDefault().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e);
         }
         return tid;
index feaecbcb2c36fae192c9576b9727140f09598985..6800c4c0e8623fa386539a356632633142cbbb50 100644 (file)
@@ -71,7 +71,7 @@ public class DiskWriteModel extends Disk {
         super.setDiskName(diskname);
         try {
             fSs.modifyAttribute(fSs.getCurrentEndTime(), TmfStateValue.newValueString(diskname), getQuark());
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             Activator.getDefault().logError("Cannot set the diskname for disk " + diskname, e); //$NON-NLS-1$
         }
     }
@@ -145,7 +145,7 @@ public class DiskWriteModel extends Disk {
 
             int mergedInQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.MERGED_IN);
             fSs.modifyAttribute(ts, TmfStateValue.nullValue(), mergedInQuark);
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             Activator.getDefault().logError("Error inserting request", e); //$NON-NLS-1$
         }
         fWaitingQueue.put(request.getSector(), new Pair<>(request, slotQuark));
@@ -192,7 +192,7 @@ public class DiskWriteModel extends Disk {
 
             int mergedInQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.MERGED_IN);
             fSs.modifyAttribute(ts, TmfStateValue.nullValue(), mergedInQuark);
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             Activator.getDefault().logError("Error inserting request", e); //$NON-NLS-1$
         }
 
@@ -275,7 +275,7 @@ public class DiskWriteModel extends Disk {
 
             int issuedFromQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.ISSUED_FROM);
             fSs.modifyAttribute(ts, issuedFromValue, issuedFromQuark);
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             Activator.getDefault().logError("Error issuing request", e); //$NON-NLS-1$
         }
 
@@ -341,7 +341,7 @@ public class DiskWriteModel extends Disk {
 
                 int issuedFromQuark = fSs.getQuarkRelativeAndAdd(mergedQuark, Attributes.MERGED_IN);
                 fSs.modifyAttribute(ts, TmfStateValue.newValueInt(Integer.parseInt(reqQueueId)), issuedFromQuark);
-            } catch (StateValueTypeException | AttributeNotFoundException e) {
+            } catch (StateValueTypeException e) {
                 Activator.getDefault().logError("Error adding the merged request information", e); //$NON-NLS-1$
             }
         }
@@ -363,7 +363,7 @@ public class DiskWriteModel extends Disk {
             fSs.modifyAttribute(ts, TmfStateValue.newValueInt(getDriverQueueSize()), fDriverQueueLength);
             int fWaitinQueueLength = fSs.getQuarkRelativeAndAdd(getQuark(), Attributes.WAITING_QUEUE_LENGTH);
             fSs.modifyAttribute(ts, TmfStateValue.newValueInt(getWaitingQueueSize()), fWaitinQueueLength);
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             Activator.getDefault().logError("Error updating queues lengths", e); //$NON-NLS-1$
         }
     }
index e7b5d9bd24a145c1b26fb20ca2aa43259b9a58c6..0f96a61fe835326153506dc548644a108c19b32d 100644 (file)
@@ -458,8 +458,6 @@ public class ControlFlowView extends AbstractStateSystemTimeGraphView {
                                     ppidInterval = ssq.querySingleState(startTime - 1, ppidQuark);
                                     startTime = execNameInterval.getStartTime();
                                     endTime = execNameInterval.getEndTime() + 1;
-                                } catch (AttributeNotFoundException e) {
-                                    Activator.getDefault().logError(e.getMessage());
                                 } catch (StateSystemDisposedException e) {
                                     /* ignored */
                                 }
@@ -773,9 +771,6 @@ public class ControlFlowView extends AbstractStateSystemTimeGraphView {
                         long end = Math.min(currentThreadInterval.getEndTime() + 1, ss.getCurrentEndTime());
                         currentThreadIntervals.add(ss.querySingleState(end, currentThreadQuark));
                     }
-                } catch (AttributeNotFoundException e) {
-                    Activator.getDefault().logError(e.getMessage());
-                    return list;
                 } catch (StateSystemDisposedException e) {
                     /* Ignored */
                     return list;
index c40c262c8506ee587567a7dc91afb136b022f1ae..2a239a6fad8992b0d0a6c8c0b087c6eb99699245 100644 (file)
@@ -25,7 +25,6 @@ import org.eclipse.tracecompass.analysis.os.linux.core.kernelmemoryusage.KernelM
 import org.eclipse.tracecompass.analysis.os.linux.core.kernelmemoryusage.KernelMemoryStateProvider;
 import org.eclipse.tracecompass.internal.analysis.os.linux.ui.Activator;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
@@ -183,7 +182,7 @@ public class KernelMemoryUsageTreeViewer extends AbstractTmfTreeViewer {
                     entryList.add(obj);
                 }
             }
-        } catch (StateSystemDisposedException | AttributeNotFoundException e) {
+        } catch (StateSystemDisposedException e) {
             Activator.getDefault().logError(e.getMessage(), e);
         }
         return root;
index 012f343cedf0db353b88a8bad7fe0b6876de891c..fac86915dbbf263e65b915a14c3e84bca332a6a9 100644 (file)
@@ -24,7 +24,6 @@ import org.eclipse.tracecompass.analysis.os.linux.core.tid.TidAnalysisModule;
 import org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis.kernel.KernelAnalysisBenchmark;
 import org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
 import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
 import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
@@ -135,13 +134,8 @@ public class TidAnalysisUsageBenchmark {
 
         /* Get the number of CPUs */
         int cpuCount = -1;
-        try {
-            @NonNull
-            List<@NonNull Integer> cpus = ss.getSubAttributes(ITmfStateSystem.ROOT_ATTRIBUTE, false);
-            cpuCount = cpus.size();
-        } catch (AttributeNotFoundException e) {
-            fail(e.getMessage());
-        }
+        @NonNull List<@NonNull Integer> cpus = ss.getSubAttributes(ITmfStateSystem.ROOT_ATTRIBUTE, false);
+        cpuCount = cpus.size();
         if (cpuCount < 1) {
             fail("Impossible to get the number of CPUs");
         }
index 17ba06d52903f9270e29b634e711868a6ac8cb58..d1087567b432b718dacd8b011b7da5fae5148ff9 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2015 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -335,7 +335,7 @@ public class VirtualMachineStateProvider extends AbstractTmfStateProvider {
                 break;
             }
 
-        } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) {
+        } catch (TimeRangeException | StateValueTypeException e) {
             Activator.getDefault().logError("Error handling event in VirtualMachineStateProvider", e); //$NON-NLS-1$
         }
     }
index 4352641034a4546d7f2a7623aae363c648785820..5b56d3075164db9bdffbbeefb398e896b7cca623 100644 (file)
@@ -227,11 +227,6 @@ public class VirtualMachineView extends AbstractTimeGraphView {
                 /* Add the entries for the threads */
                 buildThreadEntries(vmEntry, entryMap, startTime, endTime);
             }
-        } catch (AttributeNotFoundException e) {
-            /*
-             * The attribute may not exist yet if the state system is being
-             * built
-             */
         } catch (TimeRangeException | StateValueTypeException e) {
             Activator.getDefault().logError("VirtualMachineView: error building event list", e); //$NON-NLS-1$
         }
index 68d5426e2463afa85c6bd1ac05cdf252a9e3b5d9..28dbc5bf6e8db889eef231a6043fa99b07441bc8 100644 (file)
@@ -1,5 +1,5 @@
 /**********************************************************************
- * Copyright (c) 2014, 2015 Ericsson, École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 Ericsson, École Polytechnique de Montréal
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -22,7 +22,6 @@ import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace;
 import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
@@ -226,7 +225,7 @@ public class UstMemoryStateProvider extends AbstractTmfStateProvider {
             long prevMemValue = prevMem.unboxLong();
             prevMemValue += memoryDiff.longValue();
             ss.modifyAttribute(ts, TmfStateValue.newValueLong(prevMemValue), tidMemQuark);
-        } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) {
+        } catch (TimeRangeException | StateValueTypeException e) {
             throw new IllegalStateException(e);
         }
     }
index 4953d989f942c17f34e435ab732ad0e0aeadd4ce..30cd99d975ac80c6ae0259c945c2ba72795fbb9d 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
+ * Copyright (c) 2015, 2016 EfficiOS Inc., Alexandre Montplaisir
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -119,44 +119,40 @@ public class UstDebugInfoAnalysisModule extends TmfStateSystemAnalysisModule {
         ITmfStateSystem ss = checkNotNull(getStateSystem());
 
         Set<UstDebugInfoBinaryFile> files = new TreeSet<>();
-        try {
-            ImmutableList.Builder<Integer> builder = ImmutableList.builder();
-            List<Integer> vpidQuarks = ss.getSubAttributes(-1, false);
-            for (Integer vpidQuark : vpidQuarks) {
-                builder.addAll(ss.getSubAttributes(vpidQuark, false));
-            }
-            List<Integer> baddrQuarks = builder.build();
+        ImmutableList.Builder<Integer> builder = ImmutableList.builder();
+        List<Integer> vpidQuarks = ss.getSubAttributes(-1, false);
+        for (Integer vpidQuark : vpidQuarks) {
+            builder.addAll(ss.getSubAttributes(vpidQuark, false));
+        }
+        List<Integer> baddrQuarks = builder.build();
 
-            /*
-             * For each "baddr" attribute, get the "buildId" sub-attribute,
-             * whose value is the file path.
-             */
+        /*
+         * For each "baddr" attribute, get the "buildId" sub-attribute,
+         * whose value is the file path.
+         */
 
-            for (Integer baddrQuark : baddrQuarks) {
+        for (Integer baddrQuark : baddrQuarks) {
 
-                List<Integer> buildIdQuarks = ss.getSubAttributes(baddrQuark, false);
-                for (Integer buildIdQuark : buildIdQuarks) {
-                    String buildId = ss.getAttributeName(buildIdQuark);
+            List<Integer> buildIdQuarks = ss.getSubAttributes(baddrQuark, false);
+            for (Integer buildIdQuark : buildIdQuarks) {
+                String buildId = ss.getAttributeName(buildIdQuark);
 
+                /*
+                 * Explore the history of this attribute "horizontally",
+                 * even though there should only be one valid interval.
+                 */
+                ITmfStateInterval interval = StateSystemUtils.queryUntilNonNullValue(ss, buildIdQuark, ss.getStartTime(), Long.MAX_VALUE);
+                if (interval == null) {
                     /*
-                     * Explore the history of this attribute "horizontally",
-                     * even though there should only be one valid interval.
+                     * If we created the attribute, we should have assigned
+                     * a value to it!
                      */
-                    ITmfStateInterval interval = StateSystemUtils.queryUntilNonNullValue(ss, buildIdQuark, ss.getStartTime(), Long.MAX_VALUE);
-                    if (interval == null) {
-                        /*
-                         * If we created the attribute, we should have assigned
-                         * a value to it!
-                         */
-                        throw new IllegalStateException();
-                    }
-                    String filePath = interval.getStateValue().unboxStr();
-
-                    files.add(new UstDebugInfoBinaryFile(filePath, buildId));
+                    throw new IllegalStateException();
                 }
+                String filePath = interval.getStateValue().unboxStr();
+
+                files.add(new UstDebugInfoBinaryFile(filePath, buildId));
             }
-        } catch (AttributeNotFoundException e) {
-            throw new IllegalStateException(e);
         }
         return files;
     }
index c47f19f527f6f3e9978a1b76bd1a0cdd5b31382a..37b57735132f4fbc27c65c16ca719ff97479010e 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
+ * Copyright (c) 2012, 2016 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -156,7 +156,7 @@ public class StateSystemPushPopTest {
             assertEquals(30, interval.getEndTime());
             assertTrue(interval.getStateValue().isNull());
 
-        } catch (AttributeNotFoundException | TimeRangeException | StateSystemDisposedException e) {
+        } catch (TimeRangeException | StateSystemDisposedException e) {
             fail(errMsg + e.toString());
         }
     }
index 71fd1f7635037a160b3d90a905e4c6a1b15fefc7..853357ef6c9d6e83e770f5bdfb201660516fd9e8 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2015 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -58,7 +58,7 @@ public class StateSystemUtilsTest {
             fStateSystem.modifyAttribute(1200L, TmfStateValue.newValueInt(10), quark);
             fStateSystem.modifyAttribute(1500L, TmfStateValue.newValueInt(20), quark);
             fStateSystem.closeHistory(2000L);
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             fail(e.getMessage());
         }
     }
index 6785c488d71cfa689a93f2ad990ddf30558d22b3..b128577860d727d126d6ca6c3df04dd5eded5c0b 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -24,7 +24,6 @@ import java.util.List;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
 import org.eclipse.tracecompass.statesystem.core.backend.StateHistoryBackendFactory;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
@@ -171,7 +170,7 @@ public class InMemoryBackendTest extends StateHistoryBackendTestBase {
             ITmfStateInterval ref[] = intervalQuery.toArray(new ITmfStateInterval[0]);
             assertArrayEquals(ref, interval);
 
-        } catch (TimeRangeException | AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (TimeRangeException | StateSystemDisposedException e) {
             fail(e.getMessage());
         }
     }
@@ -187,7 +186,7 @@ public class InMemoryBackendTest extends StateHistoryBackendTestBase {
             ITmfStateInterval interval = backend.doSingularQuery(999, 0);
             assertEquals(TmfStateValue.nullValue(), interval.getStateValue());
 
-        } catch (TimeRangeException | AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (TimeRangeException | StateSystemDisposedException e) {
             fail(e.getMessage());
         }
     }
@@ -205,7 +204,7 @@ public class InMemoryBackendTest extends StateHistoryBackendTestBase {
             assertEquals(90, interval.getEndTime());
             assertEquals(0, interval.getStateValue().unboxInt());
 
-        } catch (TimeRangeException | AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (TimeRangeException | StateSystemDisposedException e) {
             fail(e.getMessage());
         }
     }
@@ -221,7 +220,7 @@ public class InMemoryBackendTest extends StateHistoryBackendTestBase {
             ITmfStateInterval interval = backend.doSingularQuery(99998, 9);
             testInterval(interval, 99909, 99999, 99);
 
-        } catch (TimeRangeException | AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (TimeRangeException | StateSystemDisposedException e) {
             fail(e.getMessage());
         }
     }
@@ -240,7 +239,7 @@ public class InMemoryBackendTest extends StateHistoryBackendTestBase {
             ITmfStateInterval interval = backend.doSingularQuery(-1, 0);
             assertNull(interval);
 
-        } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (StateSystemDisposedException e) {
             fail(e.getMessage());
         }
     }
@@ -259,7 +258,7 @@ public class InMemoryBackendTest extends StateHistoryBackendTestBase {
             ITmfStateInterval interval = backend.doSingularQuery(100000, 0);
             assertNull(interval);
 
-        } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (StateSystemDisposedException e) {
             fail(e.getMessage());
         }
     }
index 8f0db65c9fe6369a26805c714185ab32c71e9fde..e841c5b821fbb42a0cc9802abdb64f60562c87ce 100644 (file)
@@ -20,7 +20,6 @@ import java.util.List;
 
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
@@ -338,7 +337,7 @@ public abstract class StateHistoryBackendTestBase {
             interval = backend.doSingularQuery(startTime + (2 * timeStep) + 1, intQuark);
             assertEquals("Int interval value", INT_VAL1, interval.getStateValue());
 
-        } catch (TimeRangeException | StateSystemDisposedException | IOException | AttributeNotFoundException e) {
+        } catch (TimeRangeException | StateSystemDisposedException | IOException e) {
             fail(e.getMessage());
         }
     }
index fa3ca8ed31fb9f2f880a2ab80d2d34d13087e694..e3c92bd7c424161445b3000f511137bf64c0f3bb 100644 (file)
@@ -33,7 +33,6 @@ import java.util.List;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 
 /**
  * The Attribute Tree is the /proc-like filesystem used to organize attributes.
@@ -160,10 +159,10 @@ public final class AttributeTree {
      * @return The quark of the specified attribute, or
      *         {@link ITmfStateSystem#INVALID_ATTRIBUTE} if that attribute does
      *         not exist.
+     * @throws IndexOutOfBoundsException
+     *             If the starting node quark is out of range
      */
     public synchronized int getQuarkDontAdd(int startingNodeQuark, String... subPath) {
-        assert (startingNodeQuark >= ROOT_ATTRIBUTE);
-
         Attribute prevNode;
 
         /* If subPath is empty, simply return the starting quark */
@@ -193,12 +192,12 @@ public final class AttributeTree {
      * @param subPath
      *            The path to the attribute, relative to the starting node.
      * @return The quark of the attribute represented by the path
+     * @throws IndexOutOfBoundsException
+     *             If the starting node quark is out of range
      */
     public synchronized int getQuarkAndAdd(int startingNodeQuark, String... subPath) {
         // FIXME synchronized here is probably quite costly... maybe only locking
         // the "for" would be enough?
-        assert (subPath != null && subPath.length > 0);
-        assert (startingNodeQuark >= ROOT_ATTRIBUTE);
 
         Attribute nextNode = null;
         Attribute prevNode;
@@ -246,20 +245,13 @@ public final class AttributeTree {
      *            one level deep will be returned. If true, all descendants will
      *            be returned (depth-first search)
      * @return The list of quarks representing the children attributes
-     * @throws AttributeNotFoundException
-     *             If 'attributeQuark' is invalid, or if there is no attribute
-     *             associated to it.
+     * @throws IndexOutOfBoundsException
+     *             If the attribute quark is out of range
      */
-    public synchronized @NonNull List<@NonNull Integer> getSubAttributes(int attributeQuark, boolean recursive)
-            throws AttributeNotFoundException {
+    public synchronized @NonNull List<@NonNull Integer> getSubAttributes(int attributeQuark, boolean recursive) {
         List<@NonNull Integer> listOfChildren = new ArrayList<>();
         Attribute startingAttribute;
 
-        /* Check if the quark is valid */
-        if (attributeQuark < ROOT_ATTRIBUTE || attributeQuark >= attributeList.size()) {
-            throw new AttributeNotFoundException(ss.getSSID() + " Quark:" + attributeQuark); //$NON-NLS-1$
-        }
-
         /* Set up the node from which we'll start the search */
         if (attributeQuark == ROOT_ATTRIBUTE) {
             startingAttribute = attributeTreeRoot;
@@ -281,6 +273,8 @@ public final class AttributeTree {
      *            The quark of the attribute
      * @return Quark of the parent attribute or
      *         {@link ITmfStateSystem#ROOT_ATTRIBUTE} for the root attribute
+     * @throws IndexOutOfBoundsException
+     *             If the quark is out of range
      */
     public synchronized int getParentAttributeQuark(int quark) {
         if (quark == ROOT_ATTRIBUTE) {
@@ -305,6 +299,8 @@ public final class AttributeTree {
      * @param quark
      *            The quark of the attribute
      * @return The (base) name of the attribute
+     * @throws IndexOutOfBoundsException
+     *             If the quark is out of range
      */
     public synchronized @NonNull String getAttributeName(int quark) {
         return attributeList.get(quark).getName();
@@ -316,6 +312,8 @@ public final class AttributeTree {
      * @param quark
      *            The quark of the attribute
      * @return The full path name of the attribute
+     * @throws IndexOutOfBoundsException
+     *             If the quark is out of range
      */
     public synchronized @NonNull String getFullAttributeName(int quark) {
         return attributeList.get(quark).getFullAttributeName();
@@ -328,6 +326,8 @@ public final class AttributeTree {
      * @param quark
      *            The quark of the attribute
      * @return The path elements of the full path
+     * @throws IndexOutOfBoundsException
+     *             If the quark is out of range
      */
     public synchronized String @NonNull [] getFullAttributePathArray(int quark) {
         return attributeList.get(quark).getFullAttribute();
index 3e992d483444ddf20cb8837a9517f51d5cdf4ee1..4213a597c74f94dc9b27bdc0f351430f39e621d8 100644 (file)
@@ -280,14 +280,12 @@ public class StateSystem implements ITmfStateSystemBuilder {
     }
 
     @Override
-    public List<@NonNull Integer> getSubAttributes(int quark, boolean recursive)
-            throws AttributeNotFoundException {
+    public List<@NonNull Integer> getSubAttributes(int quark, boolean recursive) {
         return getAttributeTree().getSubAttributes(quark, recursive);
     }
 
     @Override
-    public List<@NonNull Integer> getSubAttributes(int quark, boolean recursive, String pattern)
-            throws AttributeNotFoundException {
+    public List<@NonNull Integer> getSubAttributes(int quark, boolean recursive, String pattern) {
         List<Integer> all = getSubAttributes(quark, recursive);
         List<@NonNull Integer> ret = new LinkedList<>();
         for (Integer attQuark : all) {
@@ -321,40 +319,35 @@ public class StateSystem implements ITmfStateSystemBuilder {
     }
 
     private void getQuarks(Builder<@NonNull Integer> builder, int quark, List<String> pattern) {
-        try {
-            String element = pattern.get(0);
-            if (element == null) {
-                return;
+        String element = pattern.get(0);
+        if (element == null) {
+            return;
+        }
+        List<String> remainder = pattern.subList(1, pattern.size());
+        if (remainder.isEmpty()) {
+            if (element.equals(WILDCARD)) {
+                builder.addAll(getSubAttributes(quark, false));
+            } else if (element.equals(PARENT)){
+                builder.add(getParentAttributeQuark(quark));
+            } else {
+                int subQuark = optQuarkRelative(quark, element);
+                if (subQuark != INVALID_ATTRIBUTE) {
+                    builder.add(subQuark);
+                }
             }
-            List<String> remainder = pattern.subList(1, pattern.size());
-            if (remainder.isEmpty()) {
-                if (element.equals(WILDCARD)) {
-                    builder.addAll(getSubAttributes(quark, false));
-                } else if (element.equals(PARENT)){
-                    builder.add(getParentAttributeQuark(quark));
-                } else {
-                    int subQuark = optQuarkRelative(quark, element);
-                    if (subQuark != INVALID_ATTRIBUTE) {
-                        builder.add(subQuark);
-                    }
+        } else {
+            if (element.equals(WILDCARD)) {
+                for (@NonNull Integer subquark : getSubAttributes(quark, false)) {
+                    getQuarks(builder, subquark, remainder);
                 }
+            } else if (element.equals(PARENT)){
+                getQuarks(builder, getParentAttributeQuark(quark), remainder);
             } else {
-                if (element.equals(WILDCARD)) {
-                    for (@NonNull Integer subquark : getSubAttributes(quark, false)) {
-                        getQuarks(builder, subquark, remainder);
-                    }
-                } else if (element.equals(PARENT)){
-                    getQuarks(builder, getParentAttributeQuark(quark), remainder);
-                } else {
-                    int subQuark = optQuarkRelative(quark, element);
-                    if (subQuark != INVALID_ATTRIBUTE) {
-                        getQuarks(builder, subQuark, remainder);
-                    }
+                int subQuark = optQuarkRelative(quark, element);
+                if (subQuark != INVALID_ATTRIBUTE) {
+                    getQuarks(builder, subQuark, remainder);
                 }
             }
-        } catch (AttributeNotFoundException e) {
-            /* The starting node quark is out of range */
-            throw new IndexOutOfBoundsException(String.format("Index: %d, Size: %d", quark, getNbAttributes())); //$NON-NLS-1$
         }
     }
 
@@ -364,8 +357,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
 
     @Override
     public void modifyAttribute(long t, ITmfStateValue value, int attributeQuark)
-            throws TimeRangeException, AttributeNotFoundException,
-            StateValueTypeException {
+            throws TimeRangeException, StateValueTypeException {
         if (value == null) {
             /*
              * TODO Replace with @NonNull parameter (will require fixing all the
@@ -379,8 +371,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
     @Deprecated
     @Override
     public void incrementAttribute(long t, int attributeQuark)
-            throws StateValueTypeException, TimeRangeException,
-            AttributeNotFoundException {
+            throws StateValueTypeException, TimeRangeException {
         ITmfStateValue stateValue = queryOngoingState(attributeQuark);
         int prevValue = 0;
         /* if the attribute was previously null, start counting at 0 */
@@ -393,8 +384,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
 
     @Override
     public void pushAttribute(long t, ITmfStateValue value, int attributeQuark)
-            throws TimeRangeException, AttributeNotFoundException,
-            StateValueTypeException {
+            throws TimeRangeException, StateValueTypeException {
         int stackDepth;
         int subAttributeQuark;
         ITmfStateValue previousSV = transState.getOngoingStateValue(attributeQuark);
@@ -419,7 +409,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
              * out of control due to buggy insertions
              */
             String message = " Stack limit reached, not pushing"; //$NON-NLS-1$
-            throw new AttributeNotFoundException(getSSID() + " Quark:" + attributeQuark + message); //$NON-NLS-1$
+            throw new IllegalStateException(getSSID() + " Quark:" + attributeQuark + message); //$NON-NLS-1$
         }
 
         stackDepth++;
@@ -431,8 +421,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
 
     @Override
     public ITmfStateValue popAttribute(long t, int attributeQuark)
-            throws AttributeNotFoundException, TimeRangeException,
-            StateValueTypeException {
+            throws TimeRangeException, StateValueTypeException {
         /* These are the state values of the stack-attribute itself */
         ITmfStateValue previousSV = transState.getOngoingStateValue(attributeQuark);
 
@@ -461,7 +450,13 @@ public class StateSystem implements ITmfStateSystemBuilder {
         }
 
         /* The attribute should already exist at this point */
-        int subAttributeQuark = getQuarkRelative(attributeQuark, String.valueOf(stackDepth));
+        int subAttributeQuark;
+        try {
+            subAttributeQuark = getQuarkRelative(attributeQuark, String.valueOf(stackDepth));
+        } catch (AttributeNotFoundException e) {
+            String message = " Stack attribute missing sub-attribute for depth:" + stackDepth; //$NON-NLS-1$
+            throw new IllegalStateException(getSSID() + " Quark:" + attributeQuark + message); //$NON-NLS-1$
+        }
         ITmfStateValue poppedValue = queryOngoingState(subAttributeQuark);
 
         /* Update the state value of the stack-attribute */
@@ -482,11 +477,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
 
     @Override
     public void removeAttribute(long t, int attributeQuark)
-            throws TimeRangeException, AttributeNotFoundException {
-        if (attributeQuark < 0) {
-            throw new IllegalArgumentException();
-        }
-
+            throws TimeRangeException {
         /*
          * Nullify our children first, recursively. We pass 'false' because we
          * handle the recursion ourselves.
@@ -516,20 +507,17 @@ public class StateSystem implements ITmfStateSystemBuilder {
     //--------------------------------------------------------------------------
 
     @Override
-    public ITmfStateValue queryOngoingState(int attributeQuark)
-            throws AttributeNotFoundException {
+    public ITmfStateValue queryOngoingState(int attributeQuark) {
         return transState.getOngoingStateValue(attributeQuark);
     }
 
     @Override
-    public long getOngoingStartTime(int attribute)
-            throws AttributeNotFoundException {
+    public long getOngoingStartTime(int attribute) {
         return transState.getOngoingStartTime(attribute);
     }
 
     @Override
-    public void updateOngoingState(ITmfStateValue newValue, int attributeQuark)
-            throws AttributeNotFoundException {
+    public void updateOngoingState(ITmfStateValue newValue, int attributeQuark) {
         transState.changeOngoingStateValue(attributeQuark, newValue);
     }
 
@@ -588,8 +576,7 @@ public class StateSystem implements ITmfStateSystemBuilder {
 
     @Override
     public ITmfStateInterval querySingleState(long t, int attributeQuark)
-            throws AttributeNotFoundException, TimeRangeException,
-            StateSystemDisposedException {
+            throws TimeRangeException, StateSystemDisposedException {
         if (isDisposed) {
             throw new StateSystemDisposedException();
         }
index dfa22f0ebc21938fce02ef39b0e76e0c2547476f..6a013366bdcb2daa5b64df8b21f0180f87f97859 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
+ * Copyright (c) 2012, 2016 Ericsson
  * Copyright (c) 2010, 2011 École Polytechnique de Montréal
  * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
  *
@@ -23,7 +23,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
@@ -91,13 +90,12 @@ public class TransientState {
      * @param quark
      *            The quark of the attribute to look for
      * @return The corresponding state value
-     * @throws AttributeNotFoundException
-     *             If the quark is invalid
+     * @throws IndexOutOfBoundsException
+     *             If the quark is out of range
      */
-    public ITmfStateValue getOngoingStateValue(int quark) throws AttributeNotFoundException {
+    public ITmfStateValue getOngoingStateValue(int quark) {
         fRWLock.readLock().lock();
         try {
-            checkValidAttribute(quark);
             return fOngoingStateInfo.get(quark);
         } finally {
             fRWLock.readLock().unlock();
@@ -110,13 +108,12 @@ public class TransientState {
      * @param quark
      *            The quark of the attribute to look for
      * @return The start time of the current state for this attribute
-     * @throws AttributeNotFoundException
-     *             If the quark is invalid
+     * @throws IndexOutOfBoundsException
+     *             If the quark is out of range
      */
-    public long getOngoingStartTime(int quark) throws AttributeNotFoundException {
+    public long getOngoingStartTime(int quark) {
         fRWLock.readLock().lock();
         try {
-            checkValidAttribute(quark);
             return fOngoingStateStartTimes.get(quark);
         } finally {
             fRWLock.readLock().unlock();
@@ -131,14 +128,12 @@ public class TransientState {
      *            The quark of the attribute to modify
      * @param newValue
      *            The state value the attribute should have
-     * @throws AttributeNotFoundException
-     *             If the quark is invalid
+     * @throws IndexOutOfBoundsException
+     *             If the quark is out of range
      */
-    public void changeOngoingStateValue(int quark, ITmfStateValue newValue)
-            throws AttributeNotFoundException {
+    public void changeOngoingStateValue(int quark, ITmfStateValue newValue) {
         fRWLock.writeLock().lock();
         try {
-            checkValidAttribute(quark);
             fOngoingStateInfo.set(quark, newValue);
         } finally {
             fRWLock.writeLock().unlock();
@@ -153,13 +148,12 @@ public class TransientState {
      *            The quark of the attribute
      * @return An interval representing the current state (but whose end time is
      *         the current one, and probably not the "final" one)
-     * @throws AttributeNotFoundException
-     *             If the quark is invalid
+     * @throws IndexOutOfBoundsException
+     *             If the quark is out of range
      */
-    public ITmfStateInterval getOngoingInterval(int quark) throws AttributeNotFoundException {
+    public ITmfStateInterval getOngoingInterval(int quark) {
         fRWLock.readLock().lock();
         try {
-            checkValidAttribute(quark);
             return new TmfStateInterval(fOngoingStateStartTimes.get(quark), fLatestTime,
                     quark, fOngoingStateInfo.get(quark));
         } finally {
@@ -178,29 +172,22 @@ public class TransientState {
      *            The quark of the attribute to look for
      * @return The corresponding TmfStateInterval object if we could find it in
      *         this transient state, or null if we couldn't.
+     * @throws IndexOutOfBoundsException
+     *             If the quark is out of range
      */
     public @Nullable ITmfStateInterval getIntervalAt(long time, int quark) {
         fRWLock.readLock().lock();
         try {
-            checkValidAttribute(quark);
             if (!isActive() || time < fOngoingStateStartTimes.get(quark)) {
                 return null;
             }
             return new TmfStateInterval(fOngoingStateStartTimes.get(quark),
                     fLatestTime, quark, fOngoingStateInfo.get(quark));
-        } catch (AttributeNotFoundException e) {
-            return null;
         } finally {
             fRWLock.readLock().unlock();
         }
     }
 
-    private void checkValidAttribute(int quark) throws AttributeNotFoundException {
-        if (quark > fOngoingStateInfo.size() - 1 || quark < 0) {
-            throw new AttributeNotFoundException(fBackend.getSSID() + " Quark:" + quark); //$NON-NLS-1$
-        }
-    }
-
     /**
      * More advanced version of {@link #changeOngoingStateValue}. Replaces the
      * complete ongoingStateInfo in one go, and updates the
@@ -265,14 +252,14 @@ public class TransientState {
      *            The quark of the attribute that is being modified
      * @throws TimeRangeException
      *             If 'eventTime' is invalid
-     * @throws AttributeNotFoundException
-     *             IF 'quark' does not represent an existing attribute
+     * @throws IndexOutOfBoundsException
+     *             If the quark is out of range
      * @throws StateValueTypeException
      *             If the state value to be inserted is of a different type of
      *             what was inserted so far for this attribute.
      */
     public void processStateChange(long eventTime, ITmfStateValue value, int quark)
-            throws TimeRangeException, AttributeNotFoundException, StateValueTypeException {
+            throws TimeRangeException, StateValueTypeException {
         if (!this.fIsActive) {
             return;
         }
@@ -280,7 +267,6 @@ public class TransientState {
         fRWLock.writeLock().lock();
         try {
             Type expectedSvType = fStateValueTypes.get(quark);
-            checkValidAttribute(quark);
 
             /*
              * Make sure the state value type we're inserting is the same as the
index 08d87eca44b818e72ed3827840cfb001a63fb363..40e86b027a127fcb85b04f210ee7bde8d1875d3f 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -26,7 +26,6 @@ import java.util.TreeSet;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
 import org.eclipse.tracecompass.statesystem.core.interval.TmfStateInterval;
@@ -159,7 +158,7 @@ public class InMemoryBackend implements IStateHistoryBackend {
 
     @Override
     public ITmfStateInterval doSingularQuery(long t, int attributeQuark)
-            throws TimeRangeException, AttributeNotFoundException {
+            throws TimeRangeException {
         if (!checkValidTime(t)) {
             throw new TimeRangeException(ssid + " Time:" + t + ", Start:" + startTime + ", End:" + latestTime); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         }
@@ -182,7 +181,7 @@ public class InMemoryBackend implements IStateHistoryBackend {
                 }
             }
         }
-        throw new AttributeNotFoundException(ssid + " Quark:" + attributeQuark); //$NON-NLS-1$
+        return null;
     }
 
     private boolean checkValidTime(long t) {
index d5b4385b722e8d3af02d5899ae306f89704a618f..4df70c16192068ce1d1b583dda7dab8fc9bd3867 100644 (file)
@@ -223,11 +223,10 @@ public interface ITmfStateSystem {
      *            True if you want all recursive sub-attributes, false if you
      *            only want the first level.
      * @return A List of integers, matching the quarks of the sub-attributes.
-     * @throws AttributeNotFoundException
-     *             If the quark was not existing or invalid.
+     * @throws IndexOutOfBoundsException
+     *             If the quark is out of range
      */
-    @NonNull List<@NonNull Integer> getSubAttributes(int quark, boolean recursive)
-            throws AttributeNotFoundException;
+    @NonNull List<@NonNull Integer> getSubAttributes(int quark, boolean recursive);
 
     /**
      * Return the sub-attributes of the target attribute, as a List of quarks,
@@ -246,11 +245,10 @@ public interface ITmfStateSystem {
      * @return A List of integers, matching the quarks of the sub-attributes
      *         that match the regex. An empty list is returned if there is no
      *         matching attribute.
-     * @throws AttributeNotFoundException
-     *             If the 'quark' was not existing or invalid.
+     * @throws IndexOutOfBoundsException
+     *             If the quark is out of range
      */
-    @NonNull List<@NonNull Integer> getSubAttributes(int quark, boolean recursive, String pattern)
-            throws AttributeNotFoundException;
+    @NonNull List<@NonNull Integer> getSubAttributes(int quark, boolean recursive, String pattern);
 
     /**
      * Batch quark-retrieving method. This method allows you to specify a path
@@ -371,24 +369,22 @@ public interface ITmfStateSystem {
      * @param attributeQuark
      *            For which attribute we want the current state
      * @return The State value that's "current" for this attribute
-     * @throws AttributeNotFoundException
-     *             If the requested attribute is invalid
+     * @throws IndexOutOfBoundsException
+     *             If the attribute quark is out of range
      */
-    @NonNull ITmfStateValue queryOngoingState(int attributeQuark)
-            throws AttributeNotFoundException;
+    @NonNull ITmfStateValue queryOngoingState(int attributeQuark);
 
     /**
      * Get the start time of the current ongoing state, for the specified
      * attribute.
      *
-     * @param attribute
+     * @param attributeQuark
      *            Quark of the attribute
      * @return The current start time of the ongoing state
-     * @throws AttributeNotFoundException
-     *             If the attribute is invalid
+     * @throws IndexOutOfBoundsException
+     *             If the attribute quark is out of range
      */
-    long getOngoingStartTime(int attribute)
-            throws AttributeNotFoundException;
+    long getOngoingStartTime(int attributeQuark);
 
     /**
      * Load the complete state information at time 't' into the returned List.
@@ -430,11 +426,11 @@ public interface ITmfStateSystem {
      * @return The StateInterval representing the state
      * @throws TimeRangeException
      *             If 't' is invalid
-     * @throws AttributeNotFoundException
-     *             If the requested quark does not exist in the model
+     * @throws IndexOutOfBoundsException
+     *             If the attribute quark is out of range
      * @throws StateSystemDisposedException
      *             If the query is sent after the state system has been disposed
      */
     @NonNull ITmfStateInterval querySingleState(long t, int attributeQuark)
-            throws AttributeNotFoundException, StateSystemDisposedException;
+            throws StateSystemDisposedException;
 }
\ No newline at end of file
index 9cd6dbf8d992a29c1117112dcc9fc8b10bf6dbd8..881ddf0300e62201c0f5c0e775dfa8d9ca9850da 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
+ * Copyright (c) 2012, 2016 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -13,7 +13,6 @@
 package org.eclipse.tracecompass.statesystem.core;
 
 import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
@@ -79,6 +78,8 @@ public interface ITmfStateSystemBuilder extends ITmfStateSystem {
      * @param subPath
      *            "Rest" of the path to get to the final attribute
      * @return The matching quark, either if it's new of just got created.
+     * @throws IndexOutOfBoundsException
+     *             If the starting node quark is out of range
      */
     int getQuarkRelativeAndAdd(int startingNodeQuark, String... subPath);
 
@@ -102,11 +103,10 @@ public interface ITmfStateSystemBuilder extends ITmfStateSystem {
      *            The new value that will overwrite the "current" one.
      * @param attributeQuark
      *            For which attribute in the system
-     * @throws AttributeNotFoundException
-     *             If the requested attribute is invalid
+     * @throws IndexOutOfBoundsException
+     *             If the attribute quark is out of range
      */
-    void updateOngoingState(@NonNull ITmfStateValue newValue, int attributeQuark)
-            throws AttributeNotFoundException;
+    void updateOngoingState(@NonNull ITmfStateValue newValue, int attributeQuark);
 
     /**
      * Basic attribute modification method, we simply specify a new value, for a
@@ -121,14 +121,14 @@ public interface ITmfStateSystemBuilder extends ITmfStateSystem {
      *            want to modify
      * @throws TimeRangeException
      *             If the requested time is outside of the trace's range
-     * @throws AttributeNotFoundException
-     *             If the requested attribute quark is invalid
+     * @throws IndexOutOfBoundsException
+     *             If the attribute quark is out of range
      * @throws StateValueTypeException
      *             If the inserted state value's type does not match what is
      *             already assigned to this attribute.
      */
     void modifyAttribute(long t, ITmfStateValue value, int attributeQuark)
-            throws AttributeNotFoundException, StateValueTypeException;
+            throws StateValueTypeException;
 
     /**
      * Increment attribute method. Reads the current value of a given integer
@@ -144,15 +144,15 @@ public interface ITmfStateSystemBuilder extends ITmfStateSystem {
      *             If the attribute already exists but is not of type Integer
      * @throws TimeRangeException
      *             If the given timestamp is invalid
-     * @throws AttributeNotFoundException
-     *             If the quark is invalid
+     * @throws IndexOutOfBoundsException
+     *             If the attribute quark is out of range
      * @deprecated Use
      *             {@link StateSystemBuilderUtils#incrementAttributeInt(ITmfStateSystemBuilder, long, int, int)}
      *             instead
      */
     @Deprecated
     void incrementAttribute(long t, int attributeQuark)
-            throws AttributeNotFoundException, StateValueTypeException;
+            throws StateValueTypeException;
 
     /**
      * "Push" helper method. This uses the given integer attribute as a stack:
@@ -170,14 +170,14 @@ public interface ITmfStateSystemBuilder extends ITmfStateSystem {
      *            will be created (with depth = 1)
      * @throws TimeRangeException
      *             If the requested timestamp is invalid
-     * @throws AttributeNotFoundException
-     *             If the attribute is invalid
+     * @throws IndexOutOfBoundsException
+     *             If the attribute quark is out of range
      * @throws StateValueTypeException
      *             If the attribute 'attributeQuark' already exists, but is not
      *             of integer type.
      */
     void pushAttribute(long t, ITmfStateValue value, int attributeQuark)
-            throws AttributeNotFoundException, StateValueTypeException;
+            throws StateValueTypeException;
 
     /**
      * Antagonist of the pushAttribute(), pops the top-most attribute on the
@@ -191,8 +191,8 @@ public interface ITmfStateSystemBuilder extends ITmfStateSystem {
      *            Quark of the stack-attribute to pop
      * @return The state value that was popped, or 'null' if nothing was
      *         actually removed from the stack.
-     * @throws AttributeNotFoundException
-     *             If the attribute is invalid
+     * @throws IndexOutOfBoundsException
+     *             If the attribute quark is out of range
      * @throws TimeRangeException
      *             If the timestamp is invalid
      * @throws StateValueTypeException
@@ -200,7 +200,7 @@ public interface ITmfStateSystemBuilder extends ITmfStateSystem {
      *             type is invalid (not an integer)
      */
     ITmfStateValue popAttribute(long t, int attributeQuark)
-            throws AttributeNotFoundException, StateValueTypeException;
+            throws StateValueTypeException;
 
     /**
      * Remove attribute method. Similar to the above modify- methods, with value
@@ -213,11 +213,10 @@ public interface ITmfStateSystemBuilder extends ITmfStateSystem {
      *            Attribute to remove
      * @throws TimeRangeException
      *             If the timestamp is invalid
-     * @throws AttributeNotFoundException
-     *             If the quark is invalid
+     * @throws IndexOutOfBoundsException
+     *             If the attribute quark is out of range
      */
-    void removeAttribute(long t, int attributeQuark)
-            throws AttributeNotFoundException;
+    void removeAttribute(long t, int attributeQuark);
 
     /**
      * Method to close off the History Provider. This happens for example when
index a3f8d70e99fc2332dcea7d24f92c67fc314e7d32..82ad0baa954ce03684b7d5ec9841239b1ef62a51 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2015 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -273,7 +273,7 @@ public final class StateSystemUtils {
                 }
                 current = currentInterval.getEndTime() + 1;
             }
-        } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
+        } catch (StateSystemDisposedException | TimeRangeException e) {
             /* Nothing to do */
         }
         return null;
index 093e781dc33f73159e001d61196ac67c97560d64..6e71574be6d05147a156fb8579c5a88ef74d36ea 100644 (file)
@@ -19,7 +19,6 @@ import java.util.List;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
@@ -173,17 +172,15 @@ public interface IStateHistoryBackend {
      *            The target timestamp of the query.
      * @param attributeQuark
      *            The single attribute for which you want the state interval
-     * @return The state interval matching this timestamp/attribute pair
+     * @return The state interval matching this timestamp/attribute pair, or
+     *         null if it was not found
      * @throws TimeRangeException
      *             If the timestamp was invalid
-     * @throws AttributeNotFoundException
-     *             If the quark was invalid
      * @throws StateSystemDisposedException
      *             If the state system is disposed while a request is ongoing.
      */
     ITmfStateInterval doSingularQuery(long t, int attributeQuark)
-            throws TimeRangeException, AttributeNotFoundException,
-            StateSystemDisposedException;
+            throws TimeRangeException, StateSystemDisposedException;
 
     /**
      * Debug method to print the contents of the history backend.
index 026d573ac11b65591c0de613f4ed573e52a37e5e..e4e678dd87c2c5704ee35c98cfdbe22b4a97069f 100644 (file)
@@ -17,7 +17,6 @@ import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.Activator;
 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.module.IXmlStateSystemContainer;
 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
@@ -97,7 +96,7 @@ public class TmfXmlScenarioHistoryBuilder {
             int attributeQuark = getQuarkRelativeAndAdd(ss, info.getQuark(), START_TIME);
             ITmfStateInterval state = ss.querySingleState(ts, attributeQuark);
             return state.getStartTime();
-        } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (StateSystemDisposedException e) {
             Activator.logError("failed to get the start time of the scenario", e); //$NON-NLS-1$
         }
         return -1L;
@@ -123,7 +122,7 @@ public class TmfXmlScenarioHistoryBuilder {
         try {
             int attributeQuark = getQuarkRelativeAndAdd(ss, info.getQuark(), TmfXmlStrings.STORED_FIELDS, attributeName);
             ss.modifyAttribute(ts, value, attributeQuark);
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             Activator.logError("failed to save the stored field " + attributeName, e); //$NON-NLS-1$
         }
     }
@@ -147,7 +146,7 @@ public class TmfXmlScenarioHistoryBuilder {
         try {
             int attributeQuark = getQuarkRelativeAndAdd(ss, info.getQuark(), TmfXmlStrings.STORED_FIELDS, attributeName);
             ss.modifyAttribute(ts, value, attributeQuark);
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             Activator.logError("failed to clear the stored fields", e); //$NON-NLS-1$
         }
     }
@@ -173,7 +172,7 @@ public class TmfXmlScenarioHistoryBuilder {
         try {
             int attributeQuark = getQuarkRelativeAndAdd(ss, info.getQuark(), TmfXmlStrings.STORED_FIELDS, attributeName);
             state = ss.querySingleState(ts, attributeQuark);
-        } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (StateSystemDisposedException e) {
             Activator.logError("failed to get the value of the stored field " + attributeName, e); //$NON-NLS-1$
         }
         return (state != null) ? NonNullUtils.checkNotNull(state.getStateValue()) : TmfStateValue.nullValue();
@@ -250,7 +249,7 @@ public class TmfXmlScenarioHistoryBuilder {
             int attributeQuark = getQuarkRelativeAndAdd(ss, info.getQuark(), TmfXmlStrings.STATE, stateName, START_TIME);
             ITmfStateInterval state = ss.querySingleState(ts, attributeQuark);
             return state.getStartTime();
-        } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (StateSystemDisposedException e) {
             Activator.logError("failed the start time of the state " + stateName, e); //$NON-NLS-1$
         }
         return -1l;
@@ -339,7 +338,7 @@ public class TmfXmlScenarioHistoryBuilder {
                 break;
             }
             ss.modifyAttribute(ts, value, info.getStatusQuark());
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             Activator.logError("failed to update scenario status"); //$NON-NLS-1$
         }
     }
@@ -362,7 +361,7 @@ public class TmfXmlScenarioHistoryBuilder {
             ITmfStateValue value = TmfStateValue.newValueString(info.getActiveState());
             int attributeQuark = ss.getQuarkRelativeAndAdd(info.getQuark(), TmfXmlStrings.STATE);
             ss.modifyAttribute(ts, value, attributeQuark);
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             Activator.logError("failed to update scenario state"); //$NON-NLS-1$
         }
     }
@@ -388,7 +387,7 @@ public class TmfXmlScenarioHistoryBuilder {
                 ITmfStateValue value = TmfStateValue.newValueLong(ts);
                 ss.modifyAttribute(ts, value, attributeQuark);
             }
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             Activator.logError("failed to update the start time of the state"); //$NON-NLS-1$
         }
     }
@@ -412,7 +411,7 @@ public class TmfXmlScenarioHistoryBuilder {
             ITmfStateValue value = TmfStateValue.newValueLong(ts);
             int attributeQuark = ss.getQuarkRelativeAndAdd(info.getQuark(), START_TIME);
             ss.modifyAttribute(ts, value, attributeQuark);
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             Activator.logError("failed to update the start time of the scenario"); //$NON-NLS-1$
         }
     }
index 106e85e0f1b8425fbfca2374316e06261e9cd5e0..aa9f8fe7da0e604855866f7d131415bd564f0ea2 100644 (file)
@@ -336,43 +336,40 @@ public class XmlTimeGraphView extends AbstractTimeGraphView {
         int i = 0;
         List<Integer> quarks = Collections.singletonList(baseQuark);
 
-        try {
-            while (i < paths.length) {
-                List<Integer> subQuarks = new LinkedList<>();
-                /* Replace * by .* to have a regex string */
-                String name = paths[i].replaceAll("\\*", ".*"); //$NON-NLS-1$ //$NON-NLS-2$
-                for (int relativeQuark : quarks) {
-                    for (int quark : ss.getSubAttributes(relativeQuark, false, name)) {
-                        subQuarks.add(quark);
-                    }
+        while (i < paths.length) {
+            List<Integer> subQuarks = new LinkedList<>();
+            /* Replace * by .* to have a regex string */
+            String name = paths[i].replaceAll("\\*", ".*"); //$NON-NLS-1$ //$NON-NLS-2$
+            for (int relativeQuark : quarks) {
+                for (int quark : ss.getSubAttributes(relativeQuark, false, name)) {
+                    subQuarks.add(quark);
                 }
-                quarks = subQuarks;
-                i++;
             }
+            quarks = subQuarks;
+            i++;
+        }
 
-            /* Process each quark */
-            XmlEntry currentEntry = parentEntry;
-            Element displayElement = null;
-            Map<String, XmlEntry> entryMap = new HashMap<>();
-            if (!displayElements.isEmpty()) {
-                displayElement = displayElements.get(0);
-            }
-            for (int quark : quarks) {
-                currentEntry = parentEntry;
-                /* Process the current entry, if specified */
-                if (displayElement != null) {
-                    currentEntry = processEntry(entryElement, displayElement, parentEntry, quark, ss);
-                    entryMap.put(currentEntry.getId(), currentEntry);
-                }
-                /* Process the children entry of this entry */
-                for (Element subEntryEl : entryElements) {
-                    buildEntry(subEntryEl, currentEntry, quark);
-                }
+        /* Process each quark */
+        XmlEntry currentEntry = parentEntry;
+        Element displayElement = null;
+        Map<String, XmlEntry> entryMap = new HashMap<>();
+        if (!displayElements.isEmpty()) {
+            displayElement = displayElements.get(0);
+        }
+        for (int quark : quarks) {
+            currentEntry = parentEntry;
+            /* Process the current entry, if specified */
+            if (displayElement != null) {
+                currentEntry = processEntry(entryElement, displayElement, parentEntry, quark, ss);
+                entryMap.put(currentEntry.getId(), currentEntry);
             }
-            if (!entryMap.isEmpty()) {
-                buildTree(entryMap, parentEntry);
+            /* Process the children entry of this entry */
+            for (Element subEntryEl : entryElements) {
+                buildEntry(subEntryEl, currentEntry, quark);
             }
-        } catch (AttributeNotFoundException e) {
+        }
+        if (!entryMap.isEmpty()) {
+            buildTree(entryMap, parentEntry);
         }
     }
 
@@ -417,7 +414,7 @@ public class XmlTimeGraphView extends AbstractTimeGraphView {
             }
             entryEnd = oneInterval.getEndTime();
 
-        } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (StateSystemDisposedException e) {
         }
 
         return new XmlEntry(quark, displayQuark, parentEntry.getTrace(), ss.getAttributeName(quark),
index 8be63d53f0218eea3e420c3eae335b3207ad4234..31c7cae0af15d24aa6f78d9e4469fa6140d76d8a 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2015 École Polytechnique de Montréal and others.
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal and others.
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -37,7 +37,6 @@ import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.Activator;
 import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
 import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.XmlViewInfo;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
@@ -190,22 +189,14 @@ public class XmlXYViewer extends TmfCommonXLineChartViewer {
             String[] paths = fPath.split(SPLIT_STRING);
             List<Integer> quarks = Collections.singletonList(IXmlStateSystemContainer.ROOT_QUARK);
 
-            try {
-                for (String path : paths) {
-                    List<Integer> subQuarks = new LinkedList<>();
-                    /* Replace * by .* to have a regex string */
-                    String name = WILDCARD_PATTERN.matcher(path).replaceAll(".*"); //$NON-NLS-1$
-                    for (int relativeQuark : quarks) {
-                        subQuarks.addAll(fStateSystem.getSubAttributes(relativeQuark, false, name));
-                    }
-                    quarks = subQuarks;
+            for (String path : paths) {
+                List<Integer> subQuarks = new LinkedList<>();
+                /* Replace * by .* to have a regex string */
+                String name = WILDCARD_PATTERN.matcher(path).replaceAll(".*"); //$NON-NLS-1$
+                for (int relativeQuark : quarks) {
+                    subQuarks.addAll(fStateSystem.getSubAttributes(relativeQuark, false, name));
                 }
-            } catch (AttributeNotFoundException e) {
-                /*
-                 * We get all attributes from the state system itself, this
-                 * should not happen.
-                 */
-                throw new IllegalStateException();
+                quarks = subQuarks;
             }
             return quarks;
         }
@@ -322,7 +313,7 @@ public class XmlXYViewer extends TmfCommonXLineChartViewer {
                     setSeries(data.getSeriesName(), data.getYValues());
                 }
                 updateDisplay();
-            } catch (AttributeNotFoundException | StateValueTypeException e) {
+            } catch (StateValueTypeException e) {
                 Activator.logError("Error updating the data of XML XY view", e); //$NON-NLS-1$
             } catch (StateSystemDisposedException e) {
                 return;
index 39bda59fb2aac52d5a9106d851d4bbea0db1130e..a51c30cee60f3c9126258da8a14ec18e915d15d5 100644 (file)
@@ -20,7 +20,6 @@ import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
 import org.eclipse.tracecompass.statesystem.core.StateSystemFactory;
 import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
 import org.eclipse.tracecompass.statesystem.core.backend.StateHistoryBackendFactory;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
 import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
@@ -108,21 +107,13 @@ public class AttributePoolTest {
         assertEquals("1", fStateSystem.getAttributeName(available2));
 
         /* Modify them */
-        try {
-            fStateSystem.modifyAttribute(START_TIME + 10, VALUE, available);
-            fStateSystem.modifyAttribute(START_TIME + 10, VALUE, available2);
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
-            fail(e.getMessage());
-        }
+        fStateSystem.modifyAttribute(START_TIME + 10, VALUE, available);
+        fStateSystem.modifyAttribute(START_TIME + 10, VALUE, available2);
 
         /* Recycle one and make sure it is set to null */
         pool.recycle(available, START_TIME + 20);
-        try {
-            ITmfStateValue value = fStateSystem.queryOngoingState(available);
-            assertEquals(TmfStateValue.nullValue(), value);
-        } catch (AttributeNotFoundException e) {
-            fail(e.getMessage());
-        }
+        ITmfStateValue value = fStateSystem.queryOngoingState(available);
+        assertEquals(TmfStateValue.nullValue(), value);
 
         /* Get a new one and make sure it is reusing the one just recycled */
         Integer available3 = pool.getAvailable();
@@ -176,7 +167,7 @@ public class AttributePoolTest {
             assertEquals(TmfStateValue.nullValue(), value);
             value = fStateSystem.queryOngoingState(child2);
             assertEquals(TmfStateValue.nullValue(), value);
-        } catch (StateValueTypeException | AttributeNotFoundException e) {
+        } catch (StateValueTypeException e) {
             fail(e.getMessage());
         }
     }
index 83c1150b801bce47db60f381517153d5edb459e8..02552cc58319d6776556aec167d8ed043783f628 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which
@@ -19,7 +19,6 @@ import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.internal.tmf.core.statesystem.mipmap.AbstractTmfMipmapStateProvider;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
@@ -48,7 +47,6 @@ class TmfMipmapStateProviderStub extends AbstractTmfMipmapStateProvider {
     private ITmfStateValue.Type type;
     private static final @NonNull String MIPMAP_ID = "MIPMAP_ID"; //$NON-NLS-1$
 
-    private final String ERROR_ATTRIBUTE_NOT_FOUND = "Error : Impossible to find the attribute"; //$NON-NLS-1$
     private final String ERROR_INVALID_STATE_VALUE = "Error : Invalid state value"; //$NON-NLS-1$
     private final String ERROR_INVALID_TIMESTAMP = "Error : Invalid timestamp"; //$NON-NLS-1$
 
@@ -76,8 +74,6 @@ class TmfMipmapStateProviderStub extends AbstractTmfMipmapStateProvider {
             modifyMipmapAttribute(ts, value, quark, MIN | MAX | AVG, resolution);
         } catch (TimeRangeException e) {
             Activator.logError(ERROR_INVALID_TIMESTAMP, e);
-        } catch (AttributeNotFoundException e) {
-            Activator.logError(ERROR_ATTRIBUTE_NOT_FOUND, e);
         } catch (StateValueTypeException e) {
             Activator.logError(ERROR_INVALID_STATE_VALUE, e);
         }
index ec7c344102f8e0f9b3832907fd8ea8258bb7a050..78efff52fcec689e77d044336923dbffe92b5170 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2015 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -19,7 +19,6 @@ import java.util.Set;
 
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
@@ -88,7 +87,7 @@ public class TestExperimentAnalysis extends TmfStateSystemAnalysisModule {
                     int quarkId = ss.getQuarkAbsoluteAndAdd(TRACE_QUARK_NAME);
                     ss.modifyAttribute(event.getTimestamp().getValue(), TmfStateValue.newValueInt(++fCount), quarkId);
                     fTraces.add(event.getTrace());
-                } catch (TimeRangeException | AttributeNotFoundException | StateValueTypeException e) {
+                } catch (TimeRangeException | StateValueTypeException e) {
 
                 }
             }
index bfc692ac6d7604535b50455d24f122452d98d6b6..72fb9db575e5219611c3bcd29c4240a26193d0cf 100644 (file)
@@ -18,7 +18,6 @@ import java.util.concurrent.locks.ReentrantLock;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
@@ -63,7 +62,7 @@ public class TestStateSystemProvider extends AbstractTmfStateProvider {
                 int quarkId = ss.getQuarkAbsoluteAndAdd("String");
                 int quark = ss.getQuarkRelativeAndAdd(quarkId, fString);
                 ss.modifyAttribute(event.getTimestamp().getValue(), TmfStateValue.newValueInt(fCount++), quark);
-            } catch (TimeRangeException | AttributeNotFoundException | StateValueTypeException e) {
+            } catch (TimeRangeException | StateValueTypeException e) {
 
             }
         }
@@ -114,8 +113,6 @@ public class TestStateSystemProvider extends AbstractTmfStateProvider {
         sfHandler.eventHandle(ss, event);
     }
 
-
-
     @Override
     public void processEvent(@NonNull ITmfEvent event) {
         fLock.lock();
index 472ba6fc40118f0b9f91909fc535bacf463c1c4a..89414feeff5f7166443301ef376342cc16daed96 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
  * accompanies this distribution, and is available at
@@ -28,7 +28,6 @@ import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
 import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
@@ -255,18 +254,13 @@ public class PartialHistoryBackend implements IStateHistoryBackend {
          * looking for. However, the method expects a List of *state intervals*,
          * not state values, so we'll create intervals with a dummy end time.
          */
-        try {
-            for (int i = 0; i < currentStateInfo.size(); i++) {
-                long start = 0;
-                start = ((ITmfStateSystem) fPartialSS).getOngoingStartTime(i);
-                ITmfStateValue val = ((ITmfStateSystem) fPartialSS).queryOngoingState(i);
+        for (int i = 0; i < currentStateInfo.size(); i++) {
+            long start = 0;
+            start = ((ITmfStateSystem) fPartialSS).getOngoingStartTime(i);
+            ITmfStateValue val = ((ITmfStateSystem) fPartialSS).queryOngoingState(i);
 
-                ITmfStateInterval interval = new TmfStateInterval(start, t, i, checkNotNull(val));
-                currentStateInfo.set(i, interval);
-            }
-        } catch (AttributeNotFoundException e) {
-            /* Should not happen, we iterate over existing values. */
-            e.printStackTrace();
+            ITmfStateInterval interval = new TmfStateInterval(start, t, i, checkNotNull(val));
+            currentStateInfo.set(i, interval);
         }
 
         fPartialSS.releaseQueryLock();
index ec942ba703514b6e0aff5e33f5ef253e5bb56c4c..0b2e42d6eb1e89c6fac7c1641097bad526ad7878 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which
@@ -23,7 +23,6 @@ import java.util.Set;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
@@ -135,8 +134,6 @@ public abstract class AbstractTmfMipmapStateProvider extends AbstractTmfStatePro
      *            The mipmap resolution (must be greater than 1)
      * @throws TimeRangeException
      *             If the requested time is outside of the trace's range
-     * @throws AttributeNotFoundException
-     *             If the requested attribute quark is invalid
      * @throws StateValueTypeException
      *             If the inserted state value's type does not match what is
      *             already assigned to this attribute.
@@ -145,7 +142,7 @@ public abstract class AbstractTmfMipmapStateProvider extends AbstractTmfStatePro
      * @see #AVG
      */
     public void modifyMipmapAttribute(long ts, ITmfStateValue value, int baseQuark, int mipmapFeatureBits, int resolution)
-            throws TimeRangeException, AttributeNotFoundException, StateValueTypeException {
+            throws TimeRangeException, StateValueTypeException {
         ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder());
         ss.modifyAttribute(ts, value, baseQuark);
         if (value.getType() == Type.LONG || value.getType() == Type.INTEGER || value.getType() == Type.DOUBLE || value.isNull()) {
@@ -194,8 +191,6 @@ public abstract class AbstractTmfMipmapStateProvider extends AbstractTmfStatePro
                 }
             } catch (TimeRangeException e) {
                 Activator.logError("MipMapProvider : Time stamp outside of time range of state system", e); //$NON-NLS-1$
-            } catch (AttributeNotFoundException e) {
-                Activator.logError("MipMapProvider : Attribute not found", e); //$NON-NLS-1$
             } catch (StateValueTypeException e) {
                 Activator.logError("MipMapProvider : Wrong state value type", e); //$NON-NLS-1$
             }
index 3c832ead2122c2e9c05dd370e238af74e040ff74..d1ed5d0592d7bd3debd200f200968e8d16e41524 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which
@@ -18,7 +18,6 @@ import java.util.List;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
@@ -151,8 +150,6 @@ public abstract class TmfMipmapFeature implements ITmfMipmapFeature {
             ss.modifyAttribute(startTime, value, levelQuark);
         } catch (StateValueTypeException e) {
             Activator.logError("TmfMipmapFeature : Bad state value type", e); //$NON-NLS-1$
-        } catch (AttributeNotFoundException e) {
-            Activator.logError("TmfMipmapFeature : Attribute not found", e); //$NON-NLS-1$
         } catch (TimeRangeException e) {
             Activator.logError("TmfMipmapFeature : Time stamp is out of range", e); //$NON-NLS-1$
         }
index 245876e50838c346fd0eb2d7caaada421f9e5922..7159df876d35167379da355ece44bc32ba447bfe 100644 (file)
@@ -19,7 +19,6 @@ import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
 import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
@@ -121,63 +120,58 @@ public abstract class CallStackStateProvider extends AbstractTmfStateProvider {
 
         ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder());
 
-        try {
-            /* Check if the event is a function entry */
-            ITmfStateValue functionEntryName = functionEntry(event);
-            if (functionEntryName != null) {
-                long timestamp = event.getTimestamp().toNanos();
+        /* Check if the event is a function entry */
+        ITmfStateValue functionEntryName = functionEntry(event);
+        if (functionEntryName != null) {
+            long timestamp = event.getTimestamp().toNanos();
 
-                String processName = getProcessName(event);
-                int processId = getProcessId(event);
-                if (processName == null) {
-                    processName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId);
-                }
-                int processQuark = ss.getQuarkAbsoluteAndAdd(PROCESSES, processName);
-                ss.updateOngoingState(TmfStateValue.newValueInt(processId), processQuark);
-
-                String threadName = getThreadName(event);
-                long threadId = getThreadId(event);
-                if (threadName == null) {
-                    threadName = Long.toString(threadId);
-                }
-                int threadQuark = ss.getQuarkRelativeAndAdd(processQuark, threadName);
-                ss.updateOngoingState(TmfStateValue.newValueLong(threadId), threadQuark);
-
-                int callStackQuark = ss.getQuarkRelativeAndAdd(threadQuark, CALL_STACK);
-                ITmfStateValue value = functionEntryName;
-                ss.pushAttribute(timestamp, value, callStackQuark);
-                return;
+            String processName = getProcessName(event);
+            int processId = getProcessId(event);
+            if (processName == null) {
+                processName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId);
             }
+            int processQuark = ss.getQuarkAbsoluteAndAdd(PROCESSES, processName);
+            ss.updateOngoingState(TmfStateValue.newValueInt(processId), processQuark);
 
-            /* Check if the event is a function exit */
-            ITmfStateValue functionExitState = functionExit(event);
-            if (functionExitState != null) {
-                long timestamp = event.getTimestamp().toNanos();
-                String processName = getProcessName(event);
-                if (processName == null) {
-                    int processId = getProcessId(event);
-                    processName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId);
-                }
-                String threadName = getThreadName(event);
-                if (threadName == null) {
-                    threadName = Long.toString(getThreadId(event));
-                }
-                int quark = ss.getQuarkAbsoluteAndAdd(PROCESSES, processName, threadName, CALL_STACK);
-                ITmfStateValue poppedValue = ss.popAttribute(timestamp, quark);
-                /*
-                 * Verify that the value we are popping matches the one in the
-                 * event field, unless the latter is undefined.
-                 */
-                if (!functionExitState.isNull() && !functionExitState.equals(poppedValue)) {
-                    Activator.logWarning(NLS.bind(
-                            Messages.CallStackStateProvider_UnmatchedPoppedValue,
-                            functionExitState,
-                            poppedValue));
-                }
+            String threadName = getThreadName(event);
+            long threadId = getThreadId(event);
+            if (threadName == null) {
+                threadName = Long.toString(threadId);
             }
+            int threadQuark = ss.getQuarkRelativeAndAdd(processQuark, threadName);
+            ss.updateOngoingState(TmfStateValue.newValueLong(threadId), threadQuark);
+
+            int callStackQuark = ss.getQuarkRelativeAndAdd(threadQuark, CALL_STACK);
+            ITmfStateValue value = functionEntryName;
+            ss.pushAttribute(timestamp, value, callStackQuark);
+            return;
+        }
 
-        } catch (AttributeNotFoundException e) {
-            e.printStackTrace();
+        /* Check if the event is a function exit */
+        ITmfStateValue functionExitState = functionExit(event);
+        if (functionExitState != null) {
+            long timestamp = event.getTimestamp().toNanos();
+            String processName = getProcessName(event);
+            if (processName == null) {
+                int processId = getProcessId(event);
+                processName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId);
+            }
+            String threadName = getThreadName(event);
+            if (threadName == null) {
+                threadName = Long.toString(getThreadId(event));
+            }
+            int quark = ss.getQuarkAbsoluteAndAdd(PROCESSES, processName, threadName, CALL_STACK);
+            ITmfStateValue poppedValue = ss.popAttribute(timestamp, quark);
+            /*
+             * Verify that the value we are popping matches the one in the
+             * event field, unless the latter is undefined.
+             */
+            if (!functionExitState.isNull() && !functionExitState.equals(poppedValue)) {
+                Activator.logWarning(NLS.bind(
+                        Messages.CallStackStateProvider_UnmatchedPoppedValue,
+                        functionExitState,
+                        poppedValue));
+            }
         }
     }
 
index 793e4135873325336f9e7c40332520ef2e81157f..78433f463856883b2063ec0fb6144c665ac82955 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014, 2015 Ericsson
+ * Copyright (c) 2014, 2016 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are made
  * available under the terms of the Eclipse Public License v1.0 which
@@ -18,7 +18,6 @@ import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
 import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
@@ -77,7 +76,7 @@ public class TmfStateSystemAspect implements ITmfEventAspect<String> {
         try {
             ITmfStateValue value = fSS.querySingleState(event.getTimestamp().getValue(), fAttribute).getStateValue();
             return checkNotNull(value.toString());
-        } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+        } catch (StateSystemDisposedException e) {
             return null;
         }
     }
index 309a41ff868af2dba7ba50e6e9d358d87acba778..ebc7ed76b0634d0ea42b54acdb580a8fde352d8d 100644 (file)
@@ -16,9 +16,7 @@ import java.util.Set;
 import java.util.TreeSet;
 
 import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.internal.tmf.core.Activator;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 
 /**
  * This class allows to recycle state system attributes. Instead of creating a
@@ -137,11 +135,7 @@ public class TmfAttributePool {
         if (!fQuarksInUse.remove(quark)) {
             throw new IllegalArgumentException();
         }
-        try {
-            fSs.removeAttribute(ts, quark);
-        } catch (AttributeNotFoundException e) {
-            Activator.logError("Error getting sub-attributes", e); //$NON-NLS-1$
-        }
+        fSs.removeAttribute(ts, quark);
         fAvailableQuarks.add(quark);
     }
 
index 6a8be0b32d79cc2025650f2f1334802baec76dd3..2631bc72f0300b72c3391ef971d15a12fa08cb81 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -19,7 +19,6 @@ import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.tracecompass.internal.tmf.ui.Activator;
 import org.eclipse.tracecompass.internal.tmf.ui.Messages;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
@@ -114,8 +113,6 @@ public class CallStackPresentationProvider extends TimeGraphPresentationProvider
                 if (!value.isNull()) {
                     return fView.getFunctionName(entry.getTrace(), entry.getProcessId(), event.getTime(), value);
                 }
-            } catch (AttributeNotFoundException e) {
-                Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
             } catch (TimeRangeException e) {
                 Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
             } catch (StateSystemDisposedException e) {
@@ -146,8 +143,6 @@ public class CallStackPresentationProvider extends TimeGraphPresentationProvider
                 gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
                 Utils.drawText(gc, name, bounds.x, bounds.y, bounds.width, bounds.height, true, true);
             }
-        } catch (AttributeNotFoundException e) {
-            Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
         } catch (TimeRangeException e) {
             Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
         } catch (StateSystemDisposedException e) {
index bb3a0eb8ff1a3181052eed96a56d1a18bb3cf2a3..43286766e5b02bdacc8a284634c571c6d6b60b02 100644 (file)
@@ -987,7 +987,7 @@ public class CallStackView extends AbstractTimeGraphView {
                             viewer.getTimeGraphControl().fireSelectionChanged();
                             startZoomThread(viewer.getTime0(), viewer.getTime1());
 
-                        } catch (AttributeNotFoundException | TimeRangeException | StateSystemDisposedException | StateValueTypeException e) {
+                        } catch (TimeRangeException | StateSystemDisposedException | StateValueTypeException e) {
                             Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
                         }
                     }
@@ -1032,7 +1032,7 @@ public class CallStackView extends AbstractTimeGraphView {
                             viewer.getTimeGraphControl().fireSelectionChanged();
                             startZoomThread(viewer.getTime0(), viewer.getTime1());
 
-                        } catch (AttributeNotFoundException | TimeRangeException | StateSystemDisposedException | StateValueTypeException e) {
+                        } catch (TimeRangeException | StateSystemDisposedException | StateValueTypeException e) {
                             Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
                         }
                     }
index 50053b54d194e08c483d0ec2c7dedceeb8f952d4..7b944e9016a480845897fb7d70fa939d6d5757be 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal and others.
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -29,7 +29,6 @@ import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
 import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
 import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
@@ -257,48 +256,44 @@ public class TmfStateSystemViewer extends AbstractTmfTreeViewer {
 
     private boolean updateStateEntries(ITmfStateSystem ss, List<ITmfStateInterval> fullState, TmfTreeViewerEntry parent, int parentQuark, long timestamp) {
         boolean changed = false;
-        try {
-            for (int quark : ss.getSubAttributes(parentQuark, false)) {
-                if (quark >= fullState.size()) {
-                    // attribute was created after the full state query
-                    continue;
-                }
-                ITmfStateInterval interval = fullState.get(quark);
-                StateEntry stateEntry = findStateEntry(parent, quark);
-                if (stateEntry == null) {
-                    boolean modified = fFilterStatus ?
-                            interval.getStartTime() == timestamp :
-                                !interval.getStateValue().isNull();
-                    stateEntry = new StateEntry(ss.getAttributeName(quark), quark, ss.getFullAttributePath(quark),
-                            interval.getStateValue(),
-                            TmfTimestamp.fromNanos(interval.getStartTime()),
-                            TmfTimestamp.fromNanos(interval.getEndTime()),
-                            modified);
-
-                    // update children first to know if parent is really needed
-                    updateStateEntries(ss, fullState, stateEntry, quark, timestamp);
-
-                    /*
-                     * Add this entry to parent if filtering is off, or
-                     * if the entry has children to display, or
-                     * if there is a state change at the current timestamp
-                     */
-                    if (!fFilterStatus || stateEntry.hasChildren() || interval.getStartTime() == timestamp) {
-                        parent.addChild(stateEntry);
-                        changed = true;
-                    }
-                } else {
-                    stateEntry.update(interval.getStateValue(),
-                            TmfTimestamp.fromNanos(interval.getStartTime()),
-                            TmfTimestamp.fromNanos(interval.getEndTime()));
+        for (int quark : ss.getSubAttributes(parentQuark, false)) {
+            if (quark >= fullState.size()) {
+                // attribute was created after the full state query
+                continue;
+            }
+            ITmfStateInterval interval = fullState.get(quark);
+            StateEntry stateEntry = findStateEntry(parent, quark);
+            if (stateEntry == null) {
+                boolean modified = fFilterStatus ?
+                        interval.getStartTime() == timestamp :
+                            !interval.getStateValue().isNull();
+                stateEntry = new StateEntry(ss.getAttributeName(quark), quark, ss.getFullAttributePath(quark),
+                        interval.getStateValue(),
+                        TmfTimestamp.fromNanos(interval.getStartTime()),
+                        TmfTimestamp.fromNanos(interval.getEndTime()),
+                        modified);
+
+                // update children first to know if parent is really needed
+                updateStateEntries(ss, fullState, stateEntry, quark, timestamp);
 
-                    // update children recursively
-                    updateStateEntries(ss, fullState, stateEntry, quark, timestamp);
+                /*
+                 * Add this entry to parent if filtering is off, or
+                 * if the entry has children to display, or
+                 * if there is a state change at the current timestamp
+                 */
+                if (!fFilterStatus || stateEntry.hasChildren() || interval.getStartTime() == timestamp) {
+                    parent.addChild(stateEntry);
+                    changed = true;
                 }
+            } else {
+                stateEntry.update(interval.getStateValue(),
+                        TmfTimestamp.fromNanos(interval.getStartTime()),
+                        TmfTimestamp.fromNanos(interval.getEndTime()));
 
+                // update children recursively
+                updateStateEntries(ss, fullState, stateEntry, quark, timestamp);
             }
-        } catch (AttributeNotFoundException e) {
-            /* Should not happen, we're iterating on known attributes */
+
         }
         return changed;
     }
This page took 0.0667 seconds and 5 git commands to generate.