From: Matthew Khouzam Date: Mon, 20 Apr 2015 22:30:57 +0000 (-0400) Subject: ctf: rename CTFReaderException to CTFException X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=680f917395f3c89db33e24d907f4d2c69e0f74ff;p=deliverable%2Ftracecompass.git ctf: rename CTFReaderException to CTFException CTFIOExceptions are now only thrown by *Readers and not types or other Change-Id: Id352ef121d3c94b4004e6c5fbe70c282bd131261 Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/46134 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann --- diff --git a/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/CTFTraceCallsitePerformanceTest.java b/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/CTFTraceCallsitePerformanceTest.java index 5ed9ab4770..bd87f15494 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/CTFTraceCallsitePerformanceTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/CTFTraceCallsitePerformanceTest.java @@ -20,7 +20,7 @@ import java.util.TreeSet; import org.eclipse.test.performance.Dimension; import org.eclipse.test.performance.Performance; import org.eclipse.test.performance.PerformanceMeter; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.CTFCallsite; import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace; import org.eclipse.tracecompass.ctf.core.trace.CTFTrace; @@ -75,7 +75,7 @@ public class CTFTraceCallsitePerformanceTest { /** * sets up the test by making a new trace. * - * @throws CTFReaderException + * @throws CTFException * an exception from the reader * @throws SecurityException * an exception from accessing files illegally @@ -83,7 +83,7 @@ public class CTFTraceCallsitePerformanceTest { * an exception for passing bad values */ @Before - public void setup() throws CTFReaderException, SecurityException, + public void setup() throws CTFException, SecurityException, IllegalArgumentException { assumeTrue(testTrace.exists()); fTrace = new CTFTrace(testTrace.getPath()); diff --git a/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/TraceReadBenchmark.java b/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/TraceReadBenchmark.java index e4ac9ab1ed..5fbd027f4d 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/TraceReadBenchmark.java +++ b/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/TraceReadBenchmark.java @@ -19,7 +19,7 @@ import static org.junit.Assume.assumeTrue; import org.eclipse.test.performance.Dimension; import org.eclipse.test.performance.Performance; import org.eclipse.test.performance.PerformanceMeter; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.EventDefinition; import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace; import org.eclipse.tracecompass.ctf.core.trace.CTFTrace; @@ -78,7 +78,7 @@ public class TraceReadBenchmark { traceReader.advance(); } } - } catch (CTFReaderException e) { + } catch (CTFException e) { /* Should not happen if assumeTrue() passed above */ fail("Test failed at iteration " + loop + ':' + e.getMessage()); } diff --git a/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/TraceSeekBenchmark.java b/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/TraceSeekBenchmark.java index 2f869d7e2a..4d6c0951df 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/TraceSeekBenchmark.java +++ b/org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/TraceSeekBenchmark.java @@ -23,7 +23,7 @@ import java.util.Random; import org.eclipse.test.performance.Dimension; import org.eclipse.test.performance.Performance; import org.eclipse.test.performance.PerformanceMeter; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.EventDefinition; import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace; import org.eclipse.tracecompass.ctf.core.trace.CTFTrace; @@ -56,15 +56,15 @@ public class TraceSeekBenchmark { /** * Run the benchmark scenario for the trace "kernel" * - * @throws CTFReaderException + * @throws CTFException * Should not happen */ @Test - public void testKernelTrace() throws CTFReaderException { + public void testKernelTrace() throws CTFException { readAndSeekTrace(CtfTestTrace.KERNEL, "trace-kernel", true); } - private static void readAndSeekTrace(CtfTestTrace testTrace, String testName, boolean inGlobalSummary) throws CTFReaderException { + private static void readAndSeekTrace(CtfTestTrace testTrace, String testName, boolean inGlobalSummary) throws CTFException { assumeTrue(testTrace.exists()); Performance perf = Performance.getDefault(); @@ -108,7 +108,7 @@ public class TraceSeekBenchmark { } pm.stop(); - } catch (CTFReaderException e) { + } catch (CTFException e) { /* Should not happen if assumeTrue() passed above */ fail("Test failed at iteration " + loop + ':' + e.getMessage()); } diff --git a/org.eclipse.tracecompass.ctf.core.tests/shared/org/eclipse/tracecompass/ctf/core/tests/shared/CtfTestTrace.java b/org.eclipse.tracecompass.ctf.core.tests/shared/org/eclipse/tracecompass/ctf/core/tests/shared/CtfTestTrace.java index 3cc60ba272..13f6cb3f28 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/shared/org/eclipse/tracecompass/ctf/core/tests/shared/CtfTestTrace.java +++ b/org.eclipse.tracecompass.ctf.core.tests/shared/org/eclipse/tracecompass/ctf/core/tests/shared/CtfTestTrace.java @@ -13,7 +13,7 @@ package org.eclipse.tracecompass.ctf.core.tests.shared; import java.io.File; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.tests.synthetictraces.LttngKernelTraceGenerator; import org.eclipse.tracecompass.ctf.core.trace.CTFTrace; @@ -256,10 +256,10 @@ public enum CtfTestTrace { * before calling this! * * @return The CTFTrace object - * @throws CTFReaderException + * @throws CTFException * If the trace cannot be found. */ - public CTFTrace getTrace() throws CTFReaderException { + public CTFTrace getTrace() throws CTFException { if (fTrace == null) { fTrace = new CTFTrace(fPath); } @@ -271,10 +271,10 @@ public enum CtfTestTrace { * before calling this! * * @return The CTFTrace object - * @throws CTFReaderException + * @throws CTFException * If the trace cannot be found. */ - public CTFTrace getTraceFromFile() throws CTFReaderException { + public CTFTrace getTraceFromFile() throws CTFException { if (fTraceFromFile == null) { fTraceFromFile = new CTFTrace(new File(fPath)); } @@ -289,7 +289,7 @@ public enum CtfTestTrace { public boolean exists() { try { getTrace(); - } catch (CTFReaderException e) { + } catch (CTFException e) { return false; } return true; diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/ctftestsuite/CtfTestSuiteTests.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/ctftestsuite/CtfTestSuiteTests.java index a5c8d3584d..db8b121caa 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/ctftestsuite/CtfTestSuiteTests.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/ctftestsuite/CtfTestSuiteTests.java @@ -23,7 +23,7 @@ import java.nio.file.Paths; import java.util.LinkedList; import java.util.List; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.trace.CTFTrace; import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader; import org.junit.Rule; @@ -191,7 +191,7 @@ public class CtfTestSuiteTests { checkIfWeShoudlSucceed(); } - } catch (CTFReaderException e) { + } catch (CTFException e) { checkIfWeShouldFail(e); } catch (OutOfMemoryError e) { checkIfWeShouldFail(e); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/event/CTFEventFieldTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/event/CTFEventFieldTest.java index 1f9a3eeee7..7a4d547765 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/event/CTFEventFieldTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/event/CTFEventFieldTest.java @@ -18,7 +18,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.types.Definition; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; @@ -50,10 +50,10 @@ public class CTFEventFieldTest { /** * Run the CTFEventField parseField(Definition,String) method test. * - * @throws CTFReaderException + * @throws CTFException */ @Test - public void testParseField_complex() throws CTFReaderException { + public void testParseField_complex() throws CTFException { int len = 32; IntegerDeclaration id = IntegerDeclaration.createDeclaration( len, @@ -101,10 +101,10 @@ public class CTFEventFieldTest { /** * Run the CTFEventField parseField(Definition,String) method test. * - * @throws CTFReaderException + * @throws CTFException */ @Test - public void testParseField_simple() throws CTFReaderException { + public void testParseField_simple() throws CTFException { final StringDeclaration elemType = StringDeclaration.getStringDeclaration(Encoding.UTF8); byte[] bytes = { 'T', 'e', 's', 't', '\0' }; ByteBuffer bb = testMemory(ByteBuffer.wrap(bytes)); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/io/BitBufferIntTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/io/BitBufferIntTest.java index 71537dc667..2f1d9bb353 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/io/BitBufferIntTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/io/BitBufferIntTest.java @@ -17,7 +17,7 @@ import static org.junit.Assert.assertEquals; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.junit.Before; import org.junit.Test; @@ -36,11 +36,11 @@ public class BitBufferIntTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException * Out of bounds, won't happen */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { ByteBuffer allocateDirect = ByteBuffer.allocateDirect(128); if (allocateDirect == null) { throw new IllegalStateException("Failed to allocate memory"); @@ -50,11 +50,11 @@ public class BitBufferIntTest { fixture = createBuffer(); } - private static BitBuffer createBuffer() throws CTFReaderException { + private static BitBuffer createBuffer() throws CTFException { return createBuffer(16); } - private static BitBuffer createBuffer(int j) throws CTFReaderException { + private static BitBuffer createBuffer(int j) throws CTFException { final byte[] bytes = new byte[j]; for (int i = 0; i < j; i++) { bytes[i] = (byte) (i % 0xff); @@ -71,11 +71,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#getInt} with a basic value * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testGetInt_base() throws CTFReaderException { + public void testGetInt_base() throws CTFException { int result = fixture.getInt(); assertEquals(0x020406, result); } @@ -83,11 +83,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#getInt} with explicit seek at pos 0. * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testGetInt_pos0() throws CTFReaderException { + public void testGetInt_pos0() throws CTFException { fixture.position(0); int result = fixture.getInt(); assertEquals(0x010203, result); @@ -96,11 +96,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#get} with seek at pos 1. * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testGetInt_pos1() throws CTFReaderException { + public void testGetInt_pos1() throws CTFException { fixture.position(1); long result = fixture.get(1, true); @@ -110,11 +110,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#get} with seek at pos 2. * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testGetInt_pos2() throws CTFReaderException { + public void testGetInt_pos2() throws CTFException { fixture.position(2); long result = fixture.get(0, true); @@ -124,11 +124,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#get} with explicit little-endian reading. * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testGetInt_le2() throws CTFReaderException { + public void testGetInt_le2() throws CTFException { BitBuffer leFixture = createBuffer(128); leFixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); leFixture.position(0); @@ -140,11 +140,11 @@ public class BitBufferIntTest { * Test {@link BitBuffer#get} with explicit little-endian reading, with an * offset. * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testGetInt_le1() throws CTFReaderException { + public void testGetInt_le1() throws CTFException { BitBuffer leFixture = createBuffer(128); leFixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); leFixture.position(1); @@ -156,11 +156,11 @@ public class BitBufferIntTest { * Test {@link BitBuffer#get} with a 32-bit out-of-bounds read. Should throw * an exception. * - * @throws CTFReaderException + * @throws CTFException * Expected */ - @Test(expected = CTFReaderException.class) - public void testGetInt_invalid() throws CTFReaderException { + @Test(expected = CTFException.class) + public void testGetInt_invalid() throws CTFException { BitBuffer smallFixture = createBuffer(2); smallFixture.setByteOrder(ByteOrder.BIG_ENDIAN); @@ -174,11 +174,11 @@ public class BitBufferIntTest { * Test {@link BitBuffer#get} with a 64-bit out-of-bounds read. Should throw * an exception. * - * @throws CTFReaderException + * @throws CTFException * Expected */ - @Test(expected = CTFReaderException.class) - public void testGetInt_invalid2() throws CTFReaderException { + @Test(expected = CTFException.class) + public void testGetInt_invalid2() throws CTFException { BitBuffer smallFixture = createBuffer(2); smallFixture.setByteOrder(ByteOrder.BIG_ENDIAN); @@ -191,11 +191,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#getLong}. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetLong_pos0() throws CTFReaderException { + public void testGetLong_pos0() throws CTFException { fixture.position(0); long result = fixture.getLong(); assertEquals(0x01020304050607L, result); @@ -204,11 +204,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#getLong} with an offset of 7. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetLong_pos7() throws CTFReaderException { + public void testGetLong_pos7() throws CTFException { fixture.position(7); long result = fixture.getLong(); assertEquals(0x81018202830384L, result); @@ -217,11 +217,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#getLong} with an offset of 8. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetLong_pos8() throws CTFReaderException { + public void testGetLong_pos8() throws CTFException { fixture.position(8); long result = fixture.getLong(); assertEquals(0x0102030405060708L, result); @@ -230,11 +230,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#getLong} with a little-endian buffer. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetLong_pos0LE() throws CTFReaderException { + public void testGetLong_pos0LE() throws CTFException { fixture.position(0); fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); long result = fixture.getLong(); @@ -244,11 +244,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#getLong} with a little-endian buffer at pos 7. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetLong_pos7LE() throws CTFReaderException { + public void testGetLong_pos7LE() throws CTFException { fixture.position(7); fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); long result = fixture.getLong(); @@ -258,11 +258,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#getLong} with a little-endian buffer at pos 8. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetLong_pos8LE() throws CTFReaderException { + public void testGetLong_pos8LE() throws CTFException { fixture.position(8); fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); long result = fixture.getLong(); @@ -272,11 +272,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#get} for >32 bits in length. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGet35_pos0BE() throws CTFReaderException { + public void testGet35_pos0BE() throws CTFException { fixture.position(0); long result = fixture.get(35, false); assertEquals(0x081018L, result); @@ -285,11 +285,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#get} for >32 bits in length at an offset position. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGet35_pos8BE() throws CTFReaderException { + public void testGet35_pos8BE() throws CTFException { fixture.position(8); long result = fixture.get(35, false); assertEquals(0x08101820L, result); @@ -298,11 +298,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#get} for >32 bits in length in little-endian. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGet35_pos0LE() throws CTFReaderException { + public void testGet35_pos0LE() throws CTFException { fixture.position(0); fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); long result = fixture.get(35, false); @@ -313,11 +313,11 @@ public class BitBufferIntTest { * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, at * position 7. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetLong35_pos7LE() throws CTFReaderException { + public void testGetLong35_pos7LE() throws CTFException { fixture.position(7); fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); long result = fixture.get(35, false); @@ -328,11 +328,11 @@ public class BitBufferIntTest { * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, at * position 8. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetLong35_pos8LE() throws CTFReaderException { + public void testGetLong35_pos8LE() throws CTFException { fixture.position(8); fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); long result = fixture.get(35, false); @@ -343,11 +343,11 @@ public class BitBufferIntTest { * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, for * a signed value. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetLong35s_pos0LE() throws CTFReaderException { + public void testGetLong35s_pos0LE() throws CTFException { fixture.position(0); fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); long result = fixture.get(35, true); @@ -358,11 +358,11 @@ public class BitBufferIntTest { * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, for * a signed value, at position 7. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetLong35s_pos7LE() throws CTFReaderException { + public void testGetLong35s_pos7LE() throws CTFException { fixture.position(7); fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); long result = fixture.get(35, true); @@ -373,11 +373,11 @@ public class BitBufferIntTest { * Test {@link BitBuffer#get} for >32 bits in length, in little-endian, for * a signed value, at position 8. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetLong35s_pos8LE() throws CTFReaderException { + public void testGetLong35s_pos8LE() throws CTFException { fixture.position(8); fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); long result = fixture.get(35, true); @@ -387,11 +387,11 @@ public class BitBufferIntTest { /** * Test reading negative values as signed values. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetSigned() throws CTFReaderException { + public void testGetSigned() throws CTFException { fixture.position(0); fixture.putInt(-1); fixture.putInt(-1); @@ -405,11 +405,11 @@ public class BitBufferIntTest { /** * Test reading negative values as unsigned values. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetUnsigned() throws CTFReaderException { + public void testGetUnsigned() throws CTFException { fixture.position(0); fixture.putInt(-1); fixture.putInt(-1); @@ -423,11 +423,11 @@ public class BitBufferIntTest { /** * Test reading 24 bits of a 32-bit negative value as a signed value. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGet24Signed() throws CTFReaderException { + public void testGet24Signed() throws CTFException { fixture.position(0); fixture.putInt(-1); fixture.putInt(-1); @@ -441,11 +441,11 @@ public class BitBufferIntTest { /** * Test reading 24 bits of a 32-bit negative value as an unsigned value. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGet24Unsigned() throws CTFReaderException { + public void testGet24Unsigned() throws CTFException { fixture.position(0); fixture.putInt(-1); fixture.putInt(-1); @@ -459,11 +459,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#putInt(int)} * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testPutInt() throws CTFReaderException { + public void testPutInt() throws CTFException { fixture.position(1); fixture.putInt(1); } @@ -471,11 +471,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#putInt(int, int)} * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testPutInt_length1() throws CTFReaderException { + public void testPutInt_length1() throws CTFException { fixture.position(1); fixture.putInt(1, 1); } @@ -483,11 +483,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#putInt(int, int)} with length = 0. * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testPutInt_length0() throws CTFReaderException { + public void testPutInt_length0() throws CTFException { fixture.position(1); fixture.putInt(0, 1); } @@ -495,11 +495,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#putInt(int)} Little endian * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testPutIntLe() throws CTFReaderException { + public void testPutIntLe() throws CTFException { fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); fixture.position(1); fixture.putInt(1); @@ -508,11 +508,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#putInt(int, int)} Little endian * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testPutIntLe_length1() throws CTFReaderException { + public void testPutIntLe_length1() throws CTFException { fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); fixture.position(1); fixture.putInt(1, 1); @@ -521,11 +521,11 @@ public class BitBufferIntTest { /** * Test {@link BitBuffer#putInt(int, int)} with length = 0. Little endian * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testPutIntLe_length0() throws CTFReaderException { + public void testPutIntLe_length0() throws CTFException { fixture.setByteOrder(ByteOrder.LITTLE_ENDIAN); fixture.position(1); fixture.putInt(0, 1); @@ -534,11 +534,11 @@ public class BitBufferIntTest { /** * Test writing and reading a value defined in hex format. * - * @throws CTFReaderException + * @throws CTFException * Not expected */ @Test - public void testPutInt_hex() throws CTFReaderException { + public void testPutInt_hex() throws CTFException { final int value = 0x010203; for (int i = 0; i <= 32; i++) { @@ -556,11 +556,11 @@ public class BitBufferIntTest { * Test {@link BitBuffer#putInt} with an out-of-bounds length. An exception * should be thrown. * - * @throws CTFReaderException + * @throws CTFException * Expected */ - @Test(expected = CTFReaderException.class) - public void testPutInt_invalid() throws CTFReaderException { + @Test(expected = CTFException.class) + public void testPutInt_invalid() throws CTFException { BitBuffer fixture2; fixture2 = createBuffer(4); fixture2.setByteOrder(ByteOrder.BIG_ENDIAN); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/io/BitBufferTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/io/BitBufferTest.java index cb67aa9f77..76196cdf34 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/io/BitBufferTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/io/BitBufferTest.java @@ -18,7 +18,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.junit.Before; import org.junit.Test; @@ -37,11 +37,11 @@ public class BitBufferTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException * An error that cannot happen (position is under 128) */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { fixture = new BitBuffer(Util.testMemory(ByteBuffer.allocateDirect(1))); fixture.setByteOrder(ByteOrder.BIG_ENDIAN); fixture.position(1); @@ -152,11 +152,11 @@ public class BitBufferTest { /** * Run the void position(int) method test. * - * @throws CTFReaderException + * @throws CTFException * out of bounds? won't happen */ @Test - public void testSetPosition() throws CTFReaderException { + public void testSetPosition() throws CTFException { int newPosition = 1; fixture.position(newPosition); } @@ -194,11 +194,11 @@ public class BitBufferTest { /** * Test the get function * - * @throws CTFReaderException + * @throws CTFException * won't happen but we seek in a buffer */ @Test - public void testGetBytesMiddle() throws CTFReaderException { + public void testGetBytesMiddle() throws CTFException { @NonNull byte[] data = new byte[5]; // this string has been carefully selected and tested... don't change diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputPacketIndexEntryTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputPacketIndexEntryTest.java index ad9b4ebd30..b1ef3459cf 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputPacketIndexEntryTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputPacketIndexEntryTest.java @@ -20,7 +20,7 @@ import static org.junit.Assert.assertTrue; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; @@ -72,11 +72,11 @@ public class CTFStreamInputPacketIndexEntryTest { /** * Test the constructor * - * @throws CTFReaderException + * @throws CTFException * exception */ @Test - public void testStreamInputPacketIndexEntryConstructor1() throws CTFReaderException { + public void testStreamInputPacketIndexEntryConstructor1() throws CTFException { StructDeclaration sd = new StructDeclaration(8); sd.addField("timestamp_begin", IntegerDeclaration.INT_32B_DECL); sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL); @@ -101,11 +101,11 @@ public class CTFStreamInputPacketIndexEntryTest { /** * Test the constructor * - * @throws CTFReaderException + * @throws CTFException * exception */ @Test - public void testStreamInputPacketIndexEntryConstructor2() throws CTFReaderException { + public void testStreamInputPacketIndexEntryConstructor2() throws CTFException { StructDeclaration sd = new StructDeclaration(8); sd.addField("timestamp_begin", IntegerDeclaration.INT_32B_DECL); sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL); @@ -130,11 +130,11 @@ public class CTFStreamInputPacketIndexEntryTest { /** * Test the constructor * - * @throws CTFReaderException + * @throws CTFException * exception */ @Test - public void testStreamInputPacketIndexEntryConstructor3() throws CTFReaderException { + public void testStreamInputPacketIndexEntryConstructor3() throws CTFException { StructDeclaration sd = new StructDeclaration(8); sd.addField("timestamp_begin", IntegerDeclaration.INT_32B_DECL); sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL); @@ -163,11 +163,11 @@ public class CTFStreamInputPacketIndexEntryTest { /** * Test the constructor * - * @throws CTFReaderException + * @throws CTFException * exception */ @Test - public void testStreamInputPacketIndexEntryConstructor4() throws CTFReaderException { + public void testStreamInputPacketIndexEntryConstructor4() throws CTFException { StructDeclaration sd = new StructDeclaration(8); sd.addField("content_size", IntegerDeclaration.INT_32B_DECL); sd.addField("target", StringDeclaration.getStringDeclaration(Encoding.ASCII)); @@ -188,11 +188,11 @@ public class CTFStreamInputPacketIndexEntryTest { /** * Test the constructor * - * @throws CTFReaderException + * @throws CTFException * exception */ @Test - public void testStreamInputPacketIndexEntryConstructor5() throws CTFReaderException { + public void testStreamInputPacketIndexEntryConstructor5() throws CTFException { StructDeclaration sd = new StructDeclaration(8); sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL); sd.addField("content_size", IntegerDeclaration.INT_32B_DECL); @@ -216,11 +216,11 @@ public class CTFStreamInputPacketIndexEntryTest { /** * Test the constructor * - * @throws CTFReaderException + * @throws CTFException * exception */ @Test - public void testStreamInputPacketIndexEntryConstructor6() throws CTFReaderException { + public void testStreamInputPacketIndexEntryConstructor6() throws CTFException { StructDeclaration sd = new StructDeclaration(8); sd.addField("timestamp_end", IntegerDeclaration.INT_32B_DECL); sd.addField("content_size", IntegerDeclaration.INT_32B_DECL); @@ -246,11 +246,11 @@ public class CTFStreamInputPacketIndexEntryTest { /** * Run the String toString() method test. * - * @throws CTFReaderException + * @throws CTFException * won't happen */ @Test - public void testToString() throws CTFReaderException { + public void testToString() throws CTFException { String expectedResult = "StreamInputPacketIndexEntry [offsetBits=0, timestampBegin=0, timestampEnd=0]"; StructDeclaration sd = new StructDeclaration(8); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputPacketIndexTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputPacketIndexTest.java index 0291dfea3f..2d505fce3d 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputPacketIndexTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputPacketIndexTest.java @@ -13,7 +13,7 @@ package org.eclipse.tracecompass.ctf.core.tests.trace; import static org.junit.Assert.assertNotNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndex; import org.eclipse.tracecompass.internal.ctf.core.trace.StreamInputPacketIndexEntry; import org.junit.Before; @@ -34,10 +34,10 @@ public class CTFStreamInputPacketIndexTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { fixture = new StreamInputPacketIndex(); fixture.append(new StreamInputPacketIndexEntry(1L,0L)); } diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputReaderTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputReaderTest.java index 1e5b6fe84a..8cc449d60c 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputReaderTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputReaderTest.java @@ -19,7 +19,7 @@ import java.io.File; import java.io.IOException; import java.util.Set; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.EventDefinition; import org.eclipse.tracecompass.ctf.core.event.types.Definition; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; @@ -60,10 +60,10 @@ public class CTFStreamInputReaderTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { fixture = getStreamInputReader(); fixture.setName(1); fixture.setCurrentEvent(new EventDefinition(new EventDeclaration(), @@ -78,7 +78,7 @@ public class CTFStreamInputReaderTest { ); } - private static CTFStreamInputReader getStreamInputReader() throws CTFReaderException { + private static CTFStreamInputReader getStreamInputReader() throws CTFException { assumeTrue(testTrace.exists()); CTFTrace trace = testTrace.getTrace(); CTFStream s = trace.getStream((long) 0); @@ -110,11 +110,11 @@ public class CTFStreamInputReaderTest { * Run the StreamInputReader(StreamInput) constructor test, with an invalid * trace. * - * @throws CTFReaderException + * @throws CTFException * @throws IOException */ - @Test(expected = CTFReaderException.class) - public void testStreamInputReader_invalid() throws CTFReaderException, IOException { + @Test(expected = CTFException.class) + public void testStreamInputReader_invalid() throws CTFException, IOException { CTFStreamInput streamInput = new CTFStreamInput(new CTFStream(new CTFTrace("")), new File("")); try (CTFStreamInputReader result = new CTFStreamInputReader(streamInput)) { assertNotNull(result); @@ -160,11 +160,11 @@ public class CTFStreamInputReaderTest { /** * Run the void goToLastEvent() method test. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGoToLastEvent1() throws CTFReaderException { + public void testGoToLastEvent1() throws CTFException { final long endTimestamp = goToEnd(); final long endTime = 4287422460315L; assertEquals(endTime, endTimestamp); @@ -173,11 +173,11 @@ public class CTFStreamInputReaderTest { /** * Run the void goToLastEvent() method test. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGoToLastEvent2() throws CTFReaderException { + public void testGoToLastEvent2() throws CTFException { long timestamp = -1; while (fixture.readNextEvent().equals(CTFResponse.OK)) { timestamp = fixture.getCurrentEvent().getTimestamp(); @@ -186,7 +186,7 @@ public class CTFStreamInputReaderTest { assertEquals(0, timestamp - endTimestamp); } - private long goToEnd() throws CTFReaderException { + private long goToEnd() throws CTFException { fixture.goToLastEvent(); return fixture.getCurrentEvent().getTimestamp(); } @@ -194,22 +194,22 @@ public class CTFStreamInputReaderTest { /** * Run the boolean readNextEvent() method test. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testReadNextEvent() throws CTFReaderException { + public void testReadNextEvent() throws CTFException { assertEquals(CTFResponse.OK, fixture.readNextEvent()); } /** * Run the void seek(long) method test. Seek by direct timestamp * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testSeek_timestamp() throws CTFReaderException { + public void testSeek_timestamp() throws CTFException { long timestamp = 1L; fixture.seek(timestamp); } @@ -218,10 +218,10 @@ public class CTFStreamInputReaderTest { * Run the seek test. Seek by passing an EventDefinition to which we've * given the timestamp we want. * - * @throws CTFReaderException + * @throws CTFException */ @Test - public void testSeek_eventDefinition() throws CTFReaderException { + public void testSeek_eventDefinition() throws CTFException { EventDefinition eventDefinition = new EventDefinition( new EventDeclaration(), getStreamInputReader(), 1L, null, null, null, null); fixture.setCurrentEvent(eventDefinition); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputTest.java index e778c30f6c..25424dde7d 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamInputTest.java @@ -22,7 +22,7 @@ import java.io.File; import java.io.FilenameFilter; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.types.IDefinition; import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace; import org.eclipse.tracecompass.ctf.core.trace.CTFStream; @@ -47,10 +47,10 @@ public class CTFStreamInputTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { assumeTrue(testTrace.exists()); fixture = new CTFStreamInput(new CTFStream(testTrace.getTrace()), createFile()); fixture.setTimestampEnd(1L); @@ -140,14 +140,14 @@ public class CTFStreamInputTest { CTFStreamInput s2; @Test - public void testEquals1() throws CTFReaderException { + public void testEquals1() throws CTFException { s1 = new CTFStreamInput(new CTFStream(testTrace.getTrace()), createFile()); assertFalse(s1.equals(null)); } @Test - public void testEquals2() throws CTFReaderException { + public void testEquals2() throws CTFException { s1 = new CTFStreamInput(new CTFStream(testTrace.getTrace()), createFile()); assertFalse(s1.equals(new Long(23L))); @@ -155,7 +155,7 @@ public class CTFStreamInputTest { } @Test - public void testEquals3() throws CTFReaderException { + public void testEquals3() throws CTFException { s1 = new CTFStreamInput(new CTFStream(testTrace.getTrace()), createFile()); assertEquals(s1, s1); @@ -163,7 +163,7 @@ public class CTFStreamInputTest { } @Test - public void testEquals4() throws CTFReaderException { + public void testEquals4() throws CTFException { s1 = new CTFStreamInput(new CTFStream(testTrace.getTrace()), createFile()); s2 = new CTFStreamInput(new CTFStream(testTrace.getTrace()), diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamTest.java index f2afdf386b..8d6102056c 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamTest.java @@ -20,7 +20,7 @@ import java.io.FilenameFilter; import java.util.Set; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration; import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration; import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace; @@ -57,10 +57,10 @@ public class CTFStreamTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { fixture = new CTFStream(testTrace.getTrace()); fixture.setEventContext(new StructDeclaration(1L)); fixture.setPacketContext(new StructDeclaration(1L)); @@ -91,10 +91,10 @@ public class CTFStreamTest { /** * Run the Stream(CTFTrace) constructor test. * - * @throws CTFReaderException + * @throws CTFException */ @Test - public void testStream() throws CTFReaderException { + public void testStream() throws CTFException { CTFTrace trace = testTrace.getTrace(); CTFStream result = new CTFStream(trace); assertNotNull(result); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceGrowingStreamTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceGrowingStreamTest.java index 2937a0c279..f7342b54e5 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceGrowingStreamTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceGrowingStreamTest.java @@ -25,7 +25,7 @@ import java.nio.file.Path; import java.nio.file.attribute.FileAttribute; import java.util.UUID; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.trace.CTFTrace; import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader; import org.junit.Before; @@ -49,10 +49,10 @@ public class CTFTraceGrowingStreamTest { * Run before every test * * @throws IOException won't happen - * @throws CTFReaderException won't happen + * @throws CTFException won't happen */ @Before - public void init() throws IOException, CTFReaderException { + public void init() throws IOException, CTFException { fCtfDirectory = Files.createTempDirectory("temptrace", new FileAttribute[] {}); File metadata = new File(fCtfDirectory.toString() + "/" + "metadata"); fGrowingStream = new File(fCtfDirectory.toString() + "/" + "stream"); @@ -116,12 +116,12 @@ public class CTFTraceGrowingStreamTest { /** * Test a growing stream * - * @throws CTFReaderException won't happen + * @throws CTFException won't happen * @throws IOException won't happen * @throws FileNotFoundException won't happen */ @Test - public void testGrowingLive() throws CTFReaderException, FileNotFoundException, IOException { + public void testGrowingLive() throws CTFException, FileNotFoundException, IOException { try (CTFTraceReader reader = new CTFTraceReader(fFixture);) { reader.setLive(true); assertEquals("0x29", reader.getCurrentEventDef().getFields().getDefinition("f").toString()); @@ -138,12 +138,12 @@ public class CTFTraceGrowingStreamTest { /** * Test a growing stream * - * @throws CTFReaderException won't happen + * @throws CTFException won't happen * @throws IOException won't happen * @throws FileNotFoundException won't happen */ @Test - public void testGrowingNotLive() throws CTFReaderException, FileNotFoundException, IOException { + public void testGrowingNotLive() throws CTFException, FileNotFoundException, IOException { try (CTFTraceReader reader = new CTFTraceReader(fFixture);) { reader.setLive(false); assertEquals("0x29", reader.getCurrentEventDef().getFields().getDefinition("f").toString()); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceGrowingTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceGrowingTest.java index 8543fd0650..c46e217f73 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceGrowingTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceGrowingTest.java @@ -23,7 +23,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.EventDefinition; import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace; import org.eclipse.tracecompass.ctf.core.trace.CTFTrace; @@ -50,11 +50,11 @@ public class CTFTraceGrowingTest { * an IO error * @throws FileNotFoundException * file's not there - * @throws CTFReaderException + * @throws CTFException * error in metadata */ @Before - public void init() throws FileNotFoundException, IOException, CTFReaderException { + public void init() throws FileNotFoundException, IOException, CTFException { Metadata md = new Metadata(fixture); File metadata = new File(fPathName + "/" + "metadata"); @@ -73,11 +73,11 @@ public class CTFTraceGrowingTest { /** * Empty trace test * - * @throws CTFReaderException + * @throws CTFException * will not happen */ @Test - public void testEmptyStream() throws CTFReaderException { + public void testEmptyStream() throws CTFException { try (CTFTraceReader reader = new CTFTraceReader(fixture);) { assertNull(reader.getCurrentEventDef()); } @@ -86,11 +86,11 @@ public class CTFTraceGrowingTest { /** * Add a stream * - * @throws CTFReaderException + * @throws CTFException * should not happen */ @Test - public void testAddStream() throws CTFReaderException { + public void testAddStream() throws CTFException { File stream = new File(fPathName + "/" + "channel1"); try (CTFTraceReader reader = new CTFTraceReader(fixture);) { fixture.addStreamFile(stream); @@ -103,11 +103,11 @@ public class CTFTraceGrowingTest { /** * Adds two a stream * - * @throws CTFReaderException + * @throws CTFException * should not happen */ @Test - public void testAddTwoStreams1() throws CTFReaderException { + public void testAddTwoStreams1() throws CTFException { File stream = new File(fPathName + "/" + "channel1"); try (CTFTraceReader reader = new CTFTraceReader(fixture);) { fixture.addStreamFile(stream); @@ -124,11 +124,11 @@ public class CTFTraceGrowingTest { /** * Adds two a stream * - * @throws CTFReaderException + * @throws CTFException * should not happen */ @Test - public void testAddTwoStreams2() throws CTFReaderException { + public void testAddTwoStreams2() throws CTFException { File stream = new File(fPathName + "/" + "channel1"); try (CTFTraceReader reader = new CTFTraceReader(fixture);) { fixture.addStreamFile(stream); @@ -147,11 +147,11 @@ public class CTFTraceGrowingTest { /** * Tests that update does not change the position * - * @throws CTFReaderException + * @throws CTFException * should not happen */ @Test - public void testAddTwoStreams3() throws CTFReaderException { + public void testAddTwoStreams3() throws CTFException { File stream = new File(fPathName + "/" + "channel1"); try (CTFTraceReader reader = new CTFTraceReader(fixture);) { fixture.addStreamFile(stream); @@ -175,11 +175,11 @@ public class CTFTraceGrowingTest { /** * Test adding a bad stream * - * @throws CTFReaderException + * @throws CTFException * should happen */ - @Test(expected = CTFReaderException.class) - public void testAddStreamFail() throws CTFReaderException { + @Test(expected = CTFException.class) + public void testAddStreamFail() throws CTFException { File stream = new File(fPathName + "/" + "metadata"); try (CTFTraceReader reader = new CTFTraceReader(fixture);) { fixture.addStreamFile(stream); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceReaderTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceReaderTest.java index 65c4480f2d..28a394b665 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceReaderTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceReaderTest.java @@ -17,7 +17,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.EventDefinition; import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace; import org.eclipse.tracecompass.ctf.core.trace.CTFTrace; @@ -42,10 +42,10 @@ public class CTFTraceReaderTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { assumeTrue(testTrace.exists()); fixture = new CTFTraceReader(testTrace.getTrace()); } @@ -54,10 +54,10 @@ public class CTFTraceReaderTest { * Run the CTFTraceReader(CTFTrace) constructor test. Open a known good * trace. * - * @throws CTFReaderException + * @throws CTFException */ @Test - public void testOpen_existing() throws CTFReaderException { + public void testOpen_existing() throws CTFException { CTFTrace trace = testTrace.getTrace(); try (CTFTraceReader result = new CTFTraceReader(trace);) { assertNotNull(result); @@ -68,10 +68,10 @@ public class CTFTraceReaderTest { * Run the CTFTraceReader(CTFTrace) constructor test. Open a non-existing * trace, expect the exception. * - * @throws CTFReaderException + * @throws CTFException */ - @Test(expected = org.eclipse.tracecompass.ctf.core.CTFReaderException.class) - public void testOpen_nonexisting() throws CTFReaderException { + @Test(expected = org.eclipse.tracecompass.ctf.core.CTFException.class) + public void testOpen_nonexisting() throws CTFException { CTFTrace trace = new CTFTrace("badfile.bad"); try (CTFTraceReader result = new CTFTraceReader(trace);) { assertNotNull(result); @@ -82,10 +82,10 @@ public class CTFTraceReaderTest { * Run the CTFTraceReader(CTFTrace) constructor test. Try to pen an invalid * path, expect exception. * - * @throws CTFReaderException + * @throws CTFException */ - @Test(expected = org.eclipse.tracecompass.ctf.core.CTFReaderException.class) - public void testOpen_invalid() throws CTFReaderException { + @Test(expected = org.eclipse.tracecompass.ctf.core.CTFException.class) + public void testOpen_invalid() throws CTFException { CTFTrace trace = new CTFTrace(""); try (CTFTraceReader result = new CTFTraceReader(trace);) { assertNotNull(result); @@ -95,11 +95,11 @@ public class CTFTraceReaderTest { /** * Run the boolean advance() method test. Test advancing normally. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testAdvance_normal() throws CTFReaderException { + public void testAdvance_normal() throws CTFException { boolean result = fixture.advance(); assertTrue(result); } @@ -108,11 +108,11 @@ public class CTFTraceReaderTest { * Run the boolean advance() method test. Test advancing when we're at the * end, so we expect that there is no more events. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testAdvance_end() throws CTFReaderException { + public void testAdvance_end() throws CTFException { int i = 0; boolean result = fixture.advance(); while (result) { @@ -135,11 +135,11 @@ public class CTFTraceReaderTest { /** * Run the CTFTraceReader copy constructor test. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testCopyFrom() throws CTFReaderException { + public void testCopyFrom() throws CTFException { try (CTFTraceReader result = fixture.copyFrom();) { assertNotNull(result); } @@ -161,10 +161,10 @@ public class CTFTraceReaderTest { * Both trace reader are different objects, so they shouldn't "equals" each * other. * - * @throws CTFReaderException + * @throws CTFException */ @Test - public void testEquals() throws CTFReaderException { + public void testEquals() throws CTFException { try (CTFTraceReader fixture2 = new CTFTraceReader(testTrace.getTrace());) { assertEquals(fixture, fixture2); } @@ -184,11 +184,11 @@ public class CTFTraceReaderTest { * Run the getCurrentEventDef() method test. Get the last event's * definition. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGetCurrentEventDef_last() throws CTFReaderException { + public void testGetCurrentEventDef_last() throws CTFException { fixture.goToLastEvent(); EventDefinition result = fixture.getCurrentEventDef(); assertNotNull(result); @@ -215,11 +215,11 @@ public class CTFTraceReaderTest { /** * Run the void goToLastEvent() method test. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testGoToLastEvent() throws CTFReaderException { + public void testGoToLastEvent() throws CTFException { fixture.goToLastEvent(); long ts1 = getTimestamp(); long ts2 = fixture.getEndTime(); @@ -229,7 +229,7 @@ public class CTFTraceReaderTest { /** * Run the boolean hasMoreEvents() method test. * - * @throws CTFReaderException + * @throws CTFException */ @Test public void testHasMoreEvents() { @@ -240,11 +240,11 @@ public class CTFTraceReaderTest { /** * Run the void printStats() method test with no 'width' parameter. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testPrintStats_noparam() throws CTFReaderException { + public void testPrintStats_noparam() throws CTFException { fixture.advance(); fixture.printStats(); } @@ -252,11 +252,11 @@ public class CTFTraceReaderTest { /** * Run the void printStats(int) method test with width = 0. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testPrintStats_width0() throws CTFReaderException { + public void testPrintStats_width0() throws CTFException { fixture.advance(); fixture.printStats(0); } @@ -264,11 +264,11 @@ public class CTFTraceReaderTest { /** * Run the void printStats(int) method test with width = 1. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testPrintStats_width1() throws CTFReaderException { + public void testPrintStats_width1() throws CTFException { fixture.advance(); fixture.printStats(1); } @@ -276,11 +276,11 @@ public class CTFTraceReaderTest { /** * Run the void printStats(int) method test with width = 2. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testPrintStats_width2() throws CTFReaderException { + public void testPrintStats_width2() throws CTFException { fixture.advance(); fixture.printStats(2); } @@ -288,11 +288,11 @@ public class CTFTraceReaderTest { /** * Run the void printStats(int) method test with width = 10. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testPrintStats_width10() throws CTFReaderException { + public void testPrintStats_width10() throws CTFException { fixture.advance(); fixture.printStats(10); } @@ -300,11 +300,11 @@ public class CTFTraceReaderTest { /** * Run the void printStats(int) method test with width = 100. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testPrintStats_100() throws CTFReaderException { + public void testPrintStats_100() throws CTFException { for (int i = 0; i < 1000; i++) { fixture.advance(); } @@ -314,11 +314,11 @@ public class CTFTraceReaderTest { /** * Run the boolean seek(long) method test. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testSeek() throws CTFReaderException { + public void testSeek() throws CTFException { long timestamp = 1L; boolean result = fixture.seek(timestamp); assertTrue(result); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceTest.java index 6fa4abcadc..78031d78ff 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceTest.java @@ -25,7 +25,7 @@ import java.io.File; import java.nio.ByteOrder; import java.util.UUID; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.CTFClock; import org.eclipse.tracecompass.ctf.core.event.types.IDefinition; import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration; @@ -56,7 +56,7 @@ public class CTFTraceTest { assumeTrue(testTrace.exists()); try { fixture = testTrace.getTraceFromFile(); - } catch (CTFReaderException e) { + } catch (CTFException e) { /* If the assumeTrue() call passed, this should not happen. */ fail(); } @@ -75,7 +75,7 @@ public class CTFTraceTest { try { CTFTrace result = testTrace.getTraceFromFile(); assertNotNull(result.getUUID()); - } catch (CTFReaderException e) { + } catch (CTFException e) { fail(); } } @@ -83,11 +83,11 @@ public class CTFTraceTest { /** * Run the CTFTrace(File) constructor test with an invalid path. * - * @throws CTFReaderException + * @throws CTFException * is expected */ - @Test(expected = org.eclipse.tracecompass.ctf.core.CTFReaderException.class) - public void testOpen_invalid() throws CTFReaderException { + @Test(expected = org.eclipse.tracecompass.ctf.core.CTFException.class) + public void testOpen_invalid() throws CTFException { File path = new File(""); CTFTrace result = new CTFTrace(path); assertNotNull(result); @@ -116,7 +116,7 @@ public class CTFTraceTest { CTFStream stream = new CTFStream(testTrace.getTrace()); stream.setId(1234); fixture.addStream(stream); - } catch (CTFReaderException e) { + } catch (CTFException e) { fail(); } catch (ParseException e) { fail(); @@ -265,7 +265,7 @@ public class CTFTraceTest { boolean result = fixture2.packetHeaderIsSet(); assertFalse(result); - } catch (CTFReaderException e) { + } catch (CTFException e) { fail(); } } @@ -390,11 +390,11 @@ public class CTFTraceTest { /** * Test for getCallsite(eventName, ip) * - * @throws CTFReaderException + * @throws CTFException * not expected */ @Test - public void callsitePosition() throws CTFReaderException { + public void callsitePosition() throws CTFException { long ip1 = 2; long ip2 = 5; long ip3 = 7; diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/IOstructgenTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/IOstructgenTest.java index 7d021f4022..370b2af456 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/IOstructgenTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/IOstructgenTest.java @@ -24,7 +24,7 @@ import java.nio.ByteOrder; import java.util.ArrayList; import java.util.List; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration; import org.eclipse.tracecompass.ctf.core.tests.CtfCoreTestPlugin; import org.eclipse.tracecompass.ctf.core.trace.CTFTrace; @@ -415,11 +415,11 @@ public class IOstructgenTest { /** * Simple test (only the minimum) * - * @throws CTFReaderException + * @throws CTFException * something wrong happened */ @Test - public void TSDLSimpleTest() throws CTFReaderException { + public void TSDLSimpleTest() throws CTFException { createDummyTrace(simpleTSDL); trace = new CTFTrace(tempTraceDir); assertNotNull(trace); @@ -428,11 +428,11 @@ public class IOstructgenTest { /** * Test with environment variables * - * @throws CTFReaderException + * @throws CTFException * something wrong happened */ @Test - public void TSDLEnvironmentTest() throws CTFReaderException { + public void TSDLEnvironmentTest() throws CTFException { createDummyTrace(envTSDL); trace = new CTFTrace(tempTraceDir); assertNotNull(trace); @@ -441,11 +441,11 @@ public class IOstructgenTest { /** * Test with Clocks * - * @throws CTFReaderException + * @throws CTFException * something wrong happened */ @Test - public void TSDLEnumTest() throws CTFReaderException { + public void TSDLEnumTest() throws CTFException { createDummyTrace(enumTSDL); trace = new CTFTrace(tempTraceDir); assertNotNull(trace); @@ -454,11 +454,11 @@ public class IOstructgenTest { /** * Test with Clocks * - * @throws CTFReaderException + * @throws CTFException * something wrong happened */ @Test - public void TSDLClockTest() throws CTFReaderException { + public void TSDLClockTest() throws CTFException { createDummyTrace(clockTSDL); trace = new CTFTrace(tempTraceDir); assertNotNull(trace); @@ -467,11 +467,11 @@ public class IOstructgenTest { /** * Test with Contexts * - * @throws CTFReaderException + * @throws CTFException * something wrong happened */ @Test - public void TSDLContextTest() throws CTFReaderException { + public void TSDLContextTest() throws CTFException { createDummyTrace(contextTSDL); trace = new CTFTrace(tempTraceDir); assertNotNull(trace); @@ -480,11 +480,11 @@ public class IOstructgenTest { /** * Test with Callsites * - * @throws CTFReaderException + * @throws CTFException * something wrong happened */ @Test - public void TSDLCallsiteTest() throws CTFReaderException { + public void TSDLCallsiteTest() throws CTFException { createDummyTrace(callsiteTSDL); trace = new CTFTrace(tempTraceDir); assertNotNull(trace); @@ -493,11 +493,11 @@ public class IOstructgenTest { /** * Test everything * - * @throws CTFReaderException + * @throws CTFException * something wrong happened */ @Test - public void TSDLAllTest() throws CTFReaderException { + public void TSDLAllTest() throws CTFException { createDummyTrace(allDressedTSDL); trace = new CTFTrace(tempTraceDir); assertNotNull(trace); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/MetadataTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/MetadataTest.java index e1c1254581..1345371c13 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/MetadataTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/MetadataTest.java @@ -22,7 +22,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration; import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace; import org.eclipse.tracecompass.ctf.core.trace.CTFStream; @@ -167,10 +167,10 @@ public class MetadataTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { assumeTrue(testTrace.exists()); fixture = new Metadata(testTrace.getTrace()); } @@ -184,11 +184,11 @@ public class MetadataTest { } @Test - public void testTextMD() throws CTFReaderException { + public void testTextMD() throws CTFException { testSingleFragment(); } - protected CTFTrace testSingleFragment() throws CTFReaderException { + protected CTFTrace testSingleFragment() throws CTFException { fixture = new Metadata(); CTFTrace trace = fixture.getTrace(); for (CTFStream s : trace.getStreams()) { @@ -206,7 +206,7 @@ public class MetadataTest { } @Test - public void testStreamTextMD() throws CTFReaderException { + public void testStreamTextMD() throws CTFException { CTFTrace trace = testSingleFragment(); fixture.parseTextFragment(mdSecond); final List eventDeclarations = new ArrayList<>(trace.getEventDeclarations(0L)); @@ -217,10 +217,10 @@ public class MetadataTest { /** * Run the ByteOrder getDetectedByteOrder() method test. * - * @throws CTFReaderException + * @throws CTFException */ @Test - public void testGetDetectedByteOrder() throws CTFReaderException { + public void testGetDetectedByteOrder() throws CTFException { setUp(); ByteOrder result = fixture.getDetectedByteOrder(); assertNull(result); @@ -229,10 +229,10 @@ public class MetadataTest { /** * Test toString * - * @throws CTFReaderException + * @throws CTFException */ @Test - public void testToString() throws CTFReaderException { + public void testToString() throws CTFException { setUp(); String result = fixture.toString(); assertNotNull(result); @@ -241,10 +241,10 @@ public class MetadataTest { /** * Run the void parse() method test. * - * @throws CTFReaderException + * @throws CTFException */ @Test - public void testParse() throws CTFReaderException { + public void testParse() throws CTFException { setUp(); assertEquals(new UUID(0xd18e637435a1cd42L, 0x8e70a9cffa712793L), testTrace.getTrace().getUUID()); assertEquals(1332166405241713920.0, testTrace.getTrace().getClock().getClockOffset(), 200.0); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/TraceReadAllTracesTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/TraceReadAllTracesTest.java index 6670e0177f..fccfecb85c 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/TraceReadAllTracesTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/TraceReadAllTracesTest.java @@ -19,7 +19,7 @@ import static org.junit.Assume.assumeTrue; import java.util.ArrayList; import java.util.List; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.CTFStrings; import org.eclipse.tracecompass.ctf.core.event.EventDefinition; import org.eclipse.tracecompass.ctf.core.event.types.IntegerDefinition; @@ -101,7 +101,7 @@ public class TraceReadAllTracesTest { } assertEquals("Event count", fTraceEnum.getNbEvents(), count); assertEquals("Trace duration", fTraceEnum.getDuration(), (end - start) / 1000000000.0, 1.0); - } catch (CTFReaderException e) { + } catch (CTFException e) { fail(fTraceEnum.getPath() + " " + e.getMessage()); } } else { diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/ArrayDeclaration2Test.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/ArrayDeclaration2Test.java index 9aed828adf..91be8f34bb 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/ArrayDeclaration2Test.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/ArrayDeclaration2Test.java @@ -20,7 +20,7 @@ import static org.junit.Assert.assertTrue; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition; @@ -73,11 +73,11 @@ public class ArrayDeclaration2Test { * Run the ArrayDefinition createDefinition(DefinitionScope,String) method * test. * - * @throws CTFReaderException + * @throws CTFException * error in the bitbuffer */ @Test - public void testCreateDefinition() throws CTFReaderException { + public void testCreateDefinition() throws CTFException { String fieldName = ""; IDefinitionScope definitionScope = null; AbstractArrayDefinition result; diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/ArrayDefinition2Test.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/ArrayDefinition2Test.java index d688c1aa58..a1ae1217f6 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/ArrayDefinition2Test.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/ArrayDefinition2Test.java @@ -20,7 +20,7 @@ import java.util.Arrays; import java.util.List; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.scope.LexicalScope; @@ -201,11 +201,11 @@ public class ArrayDefinition2Test { /** * Run the void read(BitBuffer) method test. * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void testRead_noDefs() throws CTFReaderException { + public void testRead_noDefs() throws CTFException { BitBuffer input = new BitBuffer(Util.testMemory(ByteBuffer.allocateDirect(128))); charArrayFixture.getDeclaration().createDefinition(null, "test", input); } diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EnumDeclarationTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EnumDeclarationTest.java index 8071567883..88802aa0bf 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EnumDeclarationTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EnumDeclarationTest.java @@ -20,7 +20,7 @@ import static org.junit.Assert.assertTrue; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; @@ -84,11 +84,11 @@ public class EnumDeclarationTest { * Run the EnumDefinition createDefinition(DefinitionScope,String) method * test. * - * @throws CTFReaderException + * @throws CTFException * out of bounds error, won't happen */ @Test - public void testCreateDefinition() throws CTFReaderException { + public void testCreateDefinition() throws CTFException { IDefinitionScope definitionScope = null; String fieldName = ""; byte[] array = { 't', 'e', 's', 't', '\0', 't', 'h', 'i', 's', '\0' }; diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EventDeclarationTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EventDeclarationTest.java index 31944ae360..7545050c98 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EventDeclarationTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EventDeclarationTest.java @@ -18,7 +18,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.EventDefinition; import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration; import org.eclipse.tracecompass.ctf.core.tests.shared.CtfTestTrace; @@ -46,10 +46,10 @@ public class EventDeclarationTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { assumeTrue(testTrace.exists()); fixture = new EventDeclaration(); fixture.setContext(new StructDeclaration(1L)); @@ -91,10 +91,10 @@ public class EventDeclarationTest { /** * Run the boolean equals(Object) method test. * - * @throws CTFReaderException + * @throws CTFException */ @Test - public void testEquals() throws CTFReaderException { + public void testEquals() throws CTFException { EventDeclaration obj = new EventDeclaration(); obj.setContext(new StructDeclaration(1L)); obj.setId(1L); @@ -311,10 +311,10 @@ public class EventDeclarationTest { /** * Test for the EventDefinition class * - * @throws CTFReaderException + * @throws CTFException */ @Test - public void testEventDefinition() throws CTFReaderException { + public void testEventDefinition() throws CTFException { CTFTrace trace = testTrace.getTrace(); EventDefinition ed = null; try (CTFTraceReader tr = new CTFTraceReader(trace);) { diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EventHeaderDeclarationTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EventHeaderDeclarationTest.java index f25ab5d8c0..9b62c33f38 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EventHeaderDeclarationTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EventHeaderDeclarationTest.java @@ -18,7 +18,7 @@ import java.nio.ByteOrder; import java.util.ArrayList; import java.util.List; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration; @@ -324,11 +324,11 @@ public class EventHeaderDeclarationTest { /** * Test an compact compact header * - * @throws CTFReaderException + * @throws CTFException * if {@link BitBuffer} is null */ @Test - public void testCompactCompact() throws CTFReaderException { + public void testCompactCompact() throws CTFException { ByteBuffer buffer = ByteBuffer.allocate(16); buffer.putInt(0x80000042); byte[] validCompact1 = buffer.array(); @@ -345,11 +345,11 @@ public class EventHeaderDeclarationTest { /** * Test an extended compact header * - * @throws CTFReaderException + * @throws CTFException * if {@link BitBuffer} is null */ @Test - public void testCompactExtended() throws CTFReaderException { + public void testCompactExtended() throws CTFException { ByteBuffer buffer = ByteBuffer.allocate(16); buffer.put((byte) 0xFF); buffer.putInt(ID); @@ -368,11 +368,11 @@ public class EventHeaderDeclarationTest { /** * Test an compact large header * - * @throws CTFReaderException + * @throws CTFException * if {@link BitBuffer} is null */ @Test - public void testLargeCompact() throws CTFReaderException { + public void testLargeCompact() throws CTFException { ByteBuffer buffer = ByteBuffer.allocate(16); buffer.putShort((short) ID); buffer.putInt(TIMESTAMP); @@ -392,11 +392,11 @@ public class EventHeaderDeclarationTest { /** * Test an large large header * - * @throws CTFReaderException + * @throws CTFException * if {@link BitBuffer} is null */ @Test - public void testLargeExtended() throws CTFReaderException { + public void testLargeExtended() throws CTFException { ByteBuffer buffer = ByteBuffer.allocate(16); buffer.putShort((short) -1); buffer.putInt(ID); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/FloatDefinitionTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/FloatDefinitionTest.java index d5386e2e65..c5ef4fc6ed 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/FloatDefinitionTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/FloatDefinitionTest.java @@ -18,7 +18,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.types.FloatDeclaration; import org.eclipse.tracecompass.ctf.core.event.types.FloatDefinition; @@ -46,17 +46,17 @@ public class FloatDefinitionTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException * error creating floats */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { testFloat248(); testFloat5311(); } @Test - public void testFloat248() throws CTFReaderException { + public void testFloat248() throws CTFException { parent = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), 0); BitBuffer bb = create32BitFloatByteBuffer(); singleFixture = parent.createDefinition(null, fieldName, bb); @@ -64,7 +64,7 @@ public class FloatDefinitionTest { } @Test - public void testFloat5311() throws CTFReaderException { + public void testFloat5311() throws CTFException { parent = new FloatDeclaration(11, 53, ByteOrder.nativeOrder(), 0); BitBuffer bb = create64BitFloatByteBuffer(); doubleFixture = parent.createDefinition(null, fieldName, bb); @@ -72,7 +72,7 @@ public class FloatDefinitionTest { } @Test - public void testFloat32Bit() throws CTFReaderException { + public void testFloat32Bit() throws CTFException { for (int i = 1; i < 31; i++) { parent = new FloatDeclaration(i, 32 - i, ByteOrder.nativeOrder(), 0); @@ -83,7 +83,7 @@ public class FloatDefinitionTest { } @Test - public void testFloat64Bit() throws CTFReaderException { + public void testFloat64Bit() throws CTFException { for (int i = 1; i < 63; i++) { parent = new FloatDeclaration(i, 64 - i, ByteOrder.nativeOrder(), 0); fixture = parent.createDefinition(null, fieldName, create64BitFloatByteBuffer()); @@ -100,7 +100,7 @@ public class FloatDefinitionTest { } @Test - public void testFloat48Bit() throws CTFReaderException { + public void testFloat48Bit() throws CTFException { parent = new FloatDeclaration(12, 32, ByteOrder.nativeOrder(), 0); fixture = parent.createDefinition(null, fieldName, create64BitFloatByteBuffer()); assertNotNull(fixture); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/IntegerDefinitionTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/IntegerDefinitionTest.java index 4c1cb173f7..bfeb474ace 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/IntegerDefinitionTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/IntegerDefinitionTest.java @@ -18,7 +18,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; @@ -43,11 +43,11 @@ public class IntegerDefinitionTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException * won't happen */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { IntegerDeclaration id = IntegerDeclaration.createDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8); ByteBuffer byb = ByteBuffer.allocate(128); byb.mark(); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/IntegerEndiannessTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/IntegerEndiannessTest.java index 8a3a0497bc..695376316b 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/IntegerEndiannessTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/IntegerEndiannessTest.java @@ -20,7 +20,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; import org.eclipse.tracecompass.ctf.core.event.types.IntegerDeclaration; @@ -67,11 +67,11 @@ public class IntegerEndiannessTest { /** * Read 32-bits BE * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void test32BE() throws CTFReaderException { + public void test32BE() throws CTFException { IntegerDeclaration be = IntegerDeclaration.createDeclaration(32, true, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8); IntegerDefinition fixture_be = be.createDefinition(null, name, input); assertEquals(0xabcdef12, fixture_be.getValue()); @@ -80,11 +80,11 @@ public class IntegerEndiannessTest { /** * Read 64-bits BE * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void test64BE() throws CTFReaderException { + public void test64BE() throws CTFException { IntegerDeclaration be = IntegerDeclaration.createDeclaration(64, true, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8); IntegerDefinition fixture_be = be.createDefinition(null, name, input); assertEquals(0xabcdef123456789aL, fixture_be.getValue()); @@ -93,11 +93,11 @@ public class IntegerEndiannessTest { /** * Read 32-bits LE * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void test32LE() throws CTFReaderException { + public void test32LE() throws CTFException { IntegerDeclaration le = IntegerDeclaration.createDeclaration(32, true, 1, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, clockName, 8); IntegerDefinition fixture_le = le.createDefinition(null, name, input); assertEquals(0x12efcdab, fixture_le.getValue()); @@ -106,11 +106,11 @@ public class IntegerEndiannessTest { /** * Read 64-bits LE * - * @throws CTFReaderException + * @throws CTFException * error */ @Test - public void test64LE() throws CTFReaderException { + public void test64LE() throws CTFException { IntegerDeclaration le = IntegerDeclaration.createDeclaration(64, true, 1, ByteOrder.LITTLE_ENDIAN, Encoding.NONE, clockName, 8); IntegerDefinition fixture_le = le.createDefinition(null, name, input); assertEquals(0x9a78563412efcdabL, fixture_le.getValue()); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/SequenceDeclaration2Test.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/SequenceDeclaration2Test.java index 60158a5362..79d389695b 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/SequenceDeclaration2Test.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/SequenceDeclaration2Test.java @@ -21,7 +21,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition; import org.eclipse.tracecompass.ctf.core.event.types.Definition; @@ -84,11 +84,11 @@ public class SequenceDeclaration2Test { * Run the SequenceDefinition createDefinition(DefinitionScope,String) * method test. * - * @throws CTFReaderException + * @throws CTFException * an error in the bitbuffer */ @Test - public void testCreateDefinition() throws CTFReaderException { + public void testCreateDefinition() throws CTFException { long seqLen = 2; IntegerDeclaration id = IntegerDeclaration.createDeclaration(8, false, 8, ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, "", 32); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/SequenceDefinition2Test.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/SequenceDefinition2Test.java index d90f26387c..e6728abc6a 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/SequenceDefinition2Test.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/SequenceDefinition2Test.java @@ -16,7 +16,7 @@ import static org.junit.Assert.assertNotNull; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.types.Definition; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; @@ -52,14 +52,14 @@ public class SequenceDefinition2Test { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { fixture = initString(); } - private static ByteArrayDefinition initString() throws CTFReaderException { + private static ByteArrayDefinition initString() throws CTFException { StructDeclaration structDec; StructDefinition structDef; diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StringDeclarationTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StringDeclarationTest.java index ac855a2c4c..701672c830 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StringDeclarationTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StringDeclarationTest.java @@ -17,7 +17,7 @@ import static org.junit.Assert.assertNotNull; import java.nio.ByteBuffer; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; @@ -74,11 +74,11 @@ public class StringDeclarationTest { * Run the StringDefinition createDefinition(DefinitionScope,String) method * test. * - * @throws CTFReaderException + * @throws CTFException * out of buffer exception */ @Test - public void testCreateDefinition() throws CTFReaderException { + public void testCreateDefinition() throws CTFException { IDefinitionScope definitionScope = null; String fieldName = "id"; ByteBuffer allocate = ByteBuffer.allocate(100); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StringDefinitionTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StringDefinitionTest.java index a1718c51e3..ed77cbe5ed 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StringDefinitionTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StringDefinitionTest.java @@ -16,7 +16,7 @@ import static org.junit.Assert.assertNotNull; import java.nio.ByteBuffer; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; @@ -40,11 +40,11 @@ public class StringDefinitionTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException * won't happen */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { String name = "testString"; StringDeclaration stringDec = StringDeclaration.getStringDeclaration(Encoding.UTF8); ByteBuffer byteBuffer = ByteBuffer.allocate(100); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StructDeclarationTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StructDeclarationTest.java index 205dab8d0f..ce8d5149f6 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StructDeclarationTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StructDeclarationTest.java @@ -19,7 +19,7 @@ import static org.junit.Assert.assertTrue; import java.nio.ByteBuffer; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration; @@ -75,11 +75,11 @@ public class StructDeclarationTest { * Run the StructDefinition createDefinition(DefinitionScope,String) method * test. * - * @throws CTFReaderException + * @throws CTFException * out of bounds */ @Test - public void testCreateDefinition() throws CTFReaderException { + public void testCreateDefinition() throws CTFException { String fieldName = ""; ByteBuffer allocate = ByteBuffer.allocate(100); if (allocate == null) { diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StructDefinitionTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StructDefinitionTest.java index e563e827bf..cb13f142f3 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StructDefinitionTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/StructDefinitionTest.java @@ -18,7 +18,7 @@ import static org.junit.Assert.assertNull; import java.nio.ByteBuffer; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; @@ -65,11 +65,11 @@ public class StructDefinitionTest { /** * Perform pre-test initialization. * - * @throws CTFReaderException + * @throws CTFException * won't happen */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { StructDeclaration sDec = new StructDeclaration(12); IntegerDeclaration id = IntegerDeclaration.INT_32B_DECL; IntegerDeclaration lenDec = IntegerDeclaration.UINT_8_DECL; diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/VariantDeclarationTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/VariantDeclarationTest.java index f994aba93d..f8564e8284 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/VariantDeclarationTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/VariantDeclarationTest.java @@ -18,7 +18,7 @@ import static org.junit.Assume.assumeTrue; import java.nio.ByteBuffer; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.types.Definition; @@ -61,7 +61,7 @@ public class VariantDeclarationTest { fixture = new VariantDeclaration(); } - private static IDefinitionScope createDefinitionScope() throws CTFReaderException { + private static IDefinitionScope createDefinitionScope() throws CTFException { assumeTrue(testTrace.exists()); StructDeclaration declaration = new StructDeclaration(8); VariantDeclaration variantDeclaration = new VariantDeclaration(); @@ -133,11 +133,11 @@ public class VariantDeclarationTest { * Run the VariantDefinition createDefinition(DefinitionScope,String) method * test. * - * @throws CTFReaderException + * @throws CTFException * Should not happen */ @Test - public void testCreateDefinition() throws CTFReaderException { + public void testCreateDefinition() throws CTFException { fixture.setTag("tag"); fixture.addField("a", IntegerDeclaration.UINT_64B_DECL); IDefinitionScope definitionScope = createDefinitionScope(); diff --git a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/VariantDefinitionTest.java b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/VariantDefinitionTest.java index 6f6a56dc6a..7e9bd86cfd 100644 --- a/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/VariantDefinitionTest.java +++ b/org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/VariantDefinitionTest.java @@ -19,7 +19,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition; @@ -75,11 +75,11 @@ public class VariantDefinitionTest { * * Not sure it needs to be that complicated, oh well... * - * @throws CTFReaderException + * @throws CTFException * won't happen */ @Before - public void setUp() throws CTFReaderException { + public void setUp() throws CTFException { StructDeclaration sDec = new StructDeclaration(12); StructDeclaration smallStruct = new StructDeclaration(8); IntegerDeclaration iDec = IntegerDeclaration.createDeclaration(32, false, 32, ByteOrder.BIG_ENDIAN, Encoding.NONE, "", 8); @@ -124,11 +124,11 @@ public class VariantDefinitionTest { /** * Run the VariantDefinition(VariantDeclaration,DefinitionScope,String) * - * @throws CTFReaderException + * @throws CTFException * should not happen */ @Test - public void testVariantDefinition() throws CTFReaderException { + public void testVariantDefinition() throws CTFException { VariantDeclaration declaration = new VariantDeclaration(); declaration.setTag(""); VariantDeclaration variantDeclaration = new VariantDeclaration(); diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/CTFException.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/CTFException.java new file mode 100644 index 0000000000..ae11e0ff5b --- /dev/null +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/CTFException.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal + * + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandre Montplaisir - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.tracecompass.ctf.core; + +/** + * General exception that is thrown when there is a problem somewhere with the + * CTF trace reader. + * + * @author Alexandre Montplaisir + * @since 1.0 + */ +public class CTFException extends Exception { + + private static final long serialVersionUID = 2065258365219777672L; + + /** + * Default constructor with no message. + */ + public CTFException() { + super(); + } + + /** + * Constructor with an attached message. + * + * @param message + * The message attached to this exception + */ + public CTFException(String message) { + super(message); + } + + /** + * Re-throw an exception into this type. + * + * @param e + * The previous Exception we caught + */ + public CTFException(Exception e) { + super(e); + } + + /** + * Constructor with an attached message and re-throw an exception into this type. + * + * @param message + * The message attached to this exception + * @param exception + * The previous Exception caught + */ + public CTFException(String message, Throwable exception) { + super(message, exception); + } + +} diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/CTFReaderException.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/CTFReaderException.java deleted file mode 100644 index 94050d7521..0000000000 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/CTFReaderException.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2014 Ericsson, Ecole Polytechnique de Montreal - * - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alexandre Montplaisir - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.tracecompass.ctf.core; - -/** - * General exception that is thrown when there is a problem somewhere with the - * CTF trace reader. - * - * @author Alexandre Montplaisir - * @since 1.0 - */ -public class CTFReaderException extends Exception { - - private static final long serialVersionUID = 2065258365219777672L; - - /** - * Default constructor with no message. - */ - public CTFReaderException() { - super(); - } - - /** - * Constructor with an attached message. - * - * @param message - * The message attached to this exception - */ - public CTFReaderException(String message) { - super(message); - } - - /** - * Re-throw an exception into this type. - * - * @param e - * The previous Exception we caught - */ - public CTFReaderException(Exception e) { - super(e); - } - - /** - * Constructor with an attached message and re-throw an exception into this type. - * - * @param message - * The message attached to this exception - * @param exception - * The previous Exception caught - */ - public CTFReaderException(String message, Throwable exception) { - super(message, exception); - } - -} diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/IEventDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/IEventDeclaration.java index 5af3ec7b22..f29856bf19 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/IEventDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/IEventDeclaration.java @@ -14,7 +14,7 @@ package org.eclipse.tracecompass.ctf.core.event; import java.util.Set; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration; import org.eclipse.tracecompass.ctf.core.trace.CTFStream; @@ -38,11 +38,11 @@ public interface IEventDeclaration { * @param timestamp * The timestamp when the event was taken * @return A new EventDefinition. - * @throws CTFReaderException + * @throws CTFException * As a bitbuffer is used to read, it could have wrapped * IOExceptions. */ - EventDefinition createDefinition(CTFStreamInputReader streamInputReader, @NonNull BitBuffer input, long timestamp) throws CTFReaderException; + EventDefinition createDefinition(CTFStreamInputReader streamInputReader, @NonNull BitBuffer input, long timestamp) throws CTFException; /** * Gets the name of an event declaration diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/io/BitBuffer.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/io/BitBuffer.java index 3dde68f851..b889473a82 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/io/BitBuffer.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/io/BitBuffer.java @@ -22,7 +22,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; /** * BitBuffer @@ -107,11 +107,11 @@ public final class BitBuffer { * byte order. * * @return The int value (signed) read from the buffer - * @throws CTFReaderException + * @throws CTFException * An error occurred reading the long. This exception can be * raised if the buffer tries to read out of bounds */ - public int getInt() throws CTFReaderException { + public int getInt() throws CTFException { return getInt(BIT_INT, true); } @@ -122,11 +122,11 @@ public final class BitBuffer { * byte order. * * @return The long value (signed) read from the buffer - * @throws CTFReaderException + * @throws CTFException * An error occurred reading the long. This exception can be * raised if the buffer tries to read out of bounds */ - public long getLong() throws CTFReaderException { + public long getLong() throws CTFException { return get(BIT_LONG, true); } @@ -142,14 +142,14 @@ public final class BitBuffer { * @param signed * The sign extended flag * @return The long value read from the buffer - * @throws CTFReaderException + * @throws CTFException * An error occurred reading the data. If more than 64 bits at a * time are read, or the buffer is read beyond its end, this * exception will be raised. */ - public long get(int length, boolean signed) throws CTFReaderException { + public long get(int length, boolean signed) throws CTFException { if (length > BIT_LONG) { - throw new CTFReaderException("Cannot read a long longer than 64 bits. Rquested: " + length); //$NON-NLS-1$ + throw new CTFException("Cannot read a long longer than 64 bits. Rquested: " + length); //$NON-NLS-1$ } if (length > BIT_INT) { final int highShift = length - BIT_INT; @@ -205,11 +205,11 @@ public final class BitBuffer { * @param signed * The sign extended flag * @return The int value read from the buffer - * @throws CTFReaderException + * @throws CTFException * An error occurred reading the data. When the buffer is read * beyond its end, this exception will be raised. */ - private int getInt(int length, boolean signed) throws CTFReaderException { + private int getInt(int length, boolean signed) throws CTFException { /* Nothing to read. */ if (length == 0) { @@ -218,7 +218,7 @@ public final class BitBuffer { /* Validate that the buffer has enough bits. */ if (!canRead(length)) { - throw new CTFReaderException("Cannot read the integer, " + //$NON-NLS-1$ + throw new CTFException("Cannot read the integer, " + //$NON-NLS-1$ "the buffer does not have enough remaining space. " + //$NON-NLS-1$ "Requested:" + length); //$NON-NLS-1$ } @@ -402,11 +402,11 @@ public final class BitBuffer { * * @param value * The int value to write - * @throws CTFReaderException + * @throws CTFException * An error occurred writing the data. If the buffer is written * beyond its end, this exception will be raised. */ - public void putInt(int value) throws CTFReaderException { + public void putInt(int value) throws CTFException { putInt(BIT_INT, value); } @@ -423,15 +423,15 @@ public final class BitBuffer { * The number of bits to write * @param value * The value to write - * @throws CTFReaderException + * @throws CTFException * An error occurred writing the data. If the buffer is written * beyond its end, this exception will be raised. */ - public void putInt(int length, int value) throws CTFReaderException { + public void putInt(int length, int value) throws CTFException { final long curPos = fPosition; if (!canRead(length)) { - throw new CTFReaderException("Cannot write to bitbuffer, " //$NON-NLS-1$ + throw new CTFException("Cannot write to bitbuffer, " //$NON-NLS-1$ + "insufficient space. Requested: " + length); //$NON-NLS-1$ } if (length == 0) { @@ -618,13 +618,13 @@ public final class BitBuffer { * * @param newPosition * The new position of the buffer. - * @throws CTFReaderException + * @throws CTFException * Thrown on out of bounds exceptions */ - public void position(long newPosition) throws CTFReaderException { + public void position(long newPosition) throws CTFException { if (newPosition > fBitCapacity) { - throw new CTFReaderException("Out of bounds exception on a position move, attempting to access position: " + newPosition); //$NON-NLS-1$ + throw new CTFException("Out of bounds exception on a position move, attempting to access position: " + newPosition); //$NON-NLS-1$ } fPosition = newPosition; } diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/Declaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/Declaration.java index 018acd24b1..58dbf33dba 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/Declaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/Declaration.java @@ -12,7 +12,7 @@ package org.eclipse.tracecompass.ctf.core.event.types; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope; @@ -53,10 +53,10 @@ public abstract class Declaration implements IDeclaration { * * @param input * The bitbuffer that is being read - * @throws CTFReaderException + * @throws CTFException * Happens when there is an out of bounds exception */ - protected final void alignRead(BitBuffer input) throws CTFReaderException { + protected final void alignRead(BitBuffer input) throws CTFException { long mask = getAlignment() - 1; /* * The alignment is a power of 2 diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/EnumDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/EnumDeclaration.java index 619cc541e5..5e697f9eb0 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/EnumDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/EnumDeclaration.java @@ -19,7 +19,7 @@ import java.util.List; import java.util.Set; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; @@ -87,7 +87,7 @@ public final class EnumDeclaration extends Declaration implements ISimpleDatatyp // ------------------------------------------------------------------------ @Override - public EnumDefinition createDefinition(@Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFReaderException { + public EnumDefinition createDefinition(@Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFException { alignRead(input); IntegerDefinition value = getContainerType().createDefinition(definitionScope, fieldName, input); return new EnumDefinition(this, definitionScope, fieldName, value); diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/FloatDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/FloatDeclaration.java index 683bf978e9..cd19941b59 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/FloatDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/FloatDeclaration.java @@ -15,7 +15,7 @@ import java.nio.ByteOrder; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; @@ -109,7 +109,7 @@ public final class FloatDeclaration extends Declaration implements ISimpleDataty @Override public FloatDefinition createDefinition(@Nullable IDefinitionScope definitionScope, - String fieldName, BitBuffer input) throws CTFReaderException { + String fieldName, BitBuffer input) throws CTFException { ByteOrder byteOrder = input.getByteOrder(); input.setByteOrder(fByteOrder); double value = read(input); @@ -123,7 +123,7 @@ public final class FloatDeclaration extends Declaration implements ISimpleDataty return "[declaration] float[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$ } - private double read(BitBuffer input) throws CTFReaderException { + private double read(BitBuffer input) throws CTFException { /* Offset the buffer position wrt the current alignment */ alignRead(input); final int exp = getExponent(); @@ -138,13 +138,13 @@ public final class FloatDeclaration extends Declaration implements ISimpleDataty } private static double readRawFloat32(BitBuffer input, final int manBits, - final int expBits) throws CTFReaderException { + final int expBits) throws CTFException { long temp = input.get(32, false); return createFloat(temp, manBits - 1, expBits); } private static double readRawFloat64(BitBuffer input, final int manBits, - final int expBits) throws CTFReaderException { + final int expBits) throws CTFException { long temp = input.get(64, false); return createFloat(temp, manBits - 1, expBits); } diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/IDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/IDeclaration.java index be778153cf..9496337a51 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/IDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/IDeclaration.java @@ -13,7 +13,7 @@ package org.eclipse.tracecompass.ctf.core.event.types; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope; @@ -44,10 +44,10 @@ public interface IDeclaration { * @param input * a bitbuffer to read from * @return a reference to the definition - * @throws CTFReaderException + * @throws CTFException * error in reading */ - Definition createDefinition(IDefinitionScope definitionScope, @NonNull String fieldName, @NonNull BitBuffer input) throws CTFReaderException; + Definition createDefinition(IDefinitionScope definitionScope, @NonNull String fieldName, @NonNull BitBuffer input) throws CTFException; /** * Get the path of a definition diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/IntegerDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/IntegerDeclaration.java index 8dfec6457d..eb03d3bfcd 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/IntegerDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/IntegerDeclaration.java @@ -21,7 +21,7 @@ import java.nio.ByteOrder; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; @@ -347,7 +347,7 @@ public final class IntegerDeclaration extends Declaration implements ISimpleData @Override public IntegerDefinition createDefinition(@Nullable IDefinitionScope definitionScope, - String fieldName, BitBuffer input) throws CTFReaderException { + String fieldName, BitBuffer input) throws CTFException { ByteOrder byteOrder = input.getByteOrder(); input.setByteOrder(fByteOrder); long value = read(input); @@ -400,7 +400,7 @@ public final class IntegerDeclaration extends Declaration implements ISimpleData return checkNotNull(BigInteger.ONE.shiftLeft(significantBits).negate()); } - private long read(BitBuffer input) throws CTFReaderException { + private long read(BitBuffer input) throws CTFException { /* Offset the buffer position wrt the current alignment */ alignRead(input); @@ -419,7 +419,7 @@ public final class IntegerDeclaration extends Declaration implements ISimpleData } if (length > SIZE_64) { - throw new CTFReaderException("Cannot read an integer with over 64 bits. Length given: " + length); //$NON-NLS-1$ + throw new CTFException("Cannot read an integer with over 64 bits. Length given: " + length); //$NON-NLS-1$ } bits = input.get(length, signed); diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/StringDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/StringDeclaration.java index 302b7bfcaa..045e12d3e5 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/StringDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/StringDeclaration.java @@ -15,7 +15,7 @@ package org.eclipse.tracecompass.ctf.core.event.types; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.tracecompass.common.core.NonNullUtils; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; @@ -123,12 +123,12 @@ public class StringDeclaration extends Declaration { @Override public StringDefinition createDefinition(@Nullable IDefinitionScope definitionScope, - String fieldName, BitBuffer input) throws CTFReaderException { + String fieldName, BitBuffer input) throws CTFException { String value = read(input); return new StringDefinition(this, definitionScope, fieldName, value); } - private String read(BitBuffer input) throws CTFReaderException { + private String read(BitBuffer input) throws CTFException { /* Offset the buffer position wrt the current alignment */ alignRead(input); diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/StructDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/StructDeclaration.java index 809a26aff3..6ac65cd786 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/StructDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/StructDeclaration.java @@ -23,7 +23,7 @@ import java.util.Map.Entry; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope; @@ -158,7 +158,7 @@ public class StructDeclaration extends Declaration { @Override public StructDefinition createDefinition(IDefinitionScope definitionScope, - String fieldName, BitBuffer input) throws CTFReaderException { + String fieldName, BitBuffer input) throws CTFException { alignRead(input); final Definition[] myFields = new Definition[fFieldMap.size()]; StructDefinition structDefinition = new StructDefinition(this, definitionScope, fieldName, fFieldMap.keySet(), myFields); @@ -178,12 +178,12 @@ public class StructDeclaration extends Declaration { * @param input * a bitbuffer to read from * @return a reference to the definition - * @throws CTFReaderException + * @throws CTFException * error in reading * @since 1.0 */ public StructDefinition createDefinition(IDefinitionScope definitionScope, - ILexicalScope fieldScope, @NonNull BitBuffer input) throws CTFReaderException { + ILexicalScope fieldScope, @NonNull BitBuffer input) throws CTFException { alignRead(input); final Definition[] myFields = new Definition[fFieldMap.size()]; @@ -206,7 +206,7 @@ public class StructDeclaration extends Declaration { fMaxAlign = Math.max(fMaxAlign, declaration.getAlignment()); } - private void fillStruct(@NonNull BitBuffer input, final Definition[] myFields, StructDefinition structDefinition) throws CTFReaderException { + private void fillStruct(@NonNull BitBuffer input, final Definition[] myFields, StructDefinition structDefinition) throws CTFException { Iterator> iter = fFieldMap.entrySet().iterator(); for (int i = 0; i < fFieldMap.size(); i++) { Map.Entry entry = iter.next(); diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/VariantDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/VariantDeclaration.java index f4907068c3..2127c2fc0c 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/VariantDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/VariantDeclaration.java @@ -20,7 +20,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; @@ -117,17 +117,17 @@ public class VariantDeclaration extends Declaration { @Override public VariantDefinition createDefinition(IDefinitionScope definitionScope, - String fieldName, BitBuffer input) throws CTFReaderException { + String fieldName, BitBuffer input) throws CTFException { alignRead(input); Definition def = definitionScope.lookupDefinition(fTag); EnumDefinition tagDef = (EnumDefinition) ((def instanceof EnumDefinition) ? def : null); if (tagDef == null) { - throw new CTFReaderException("Tag is not defined " + fTag); //$NON-NLS-1$ + throw new CTFException("Tag is not defined " + fTag); //$NON-NLS-1$ } String varFieldName = tagDef.getStringValue(); fDeclarationToPopulate = fFields.get(varFieldName); if (fDeclarationToPopulate == null) { - throw new CTFReaderException("Unknown enum selector for variant " + //$NON-NLS-1$ + throw new CTFException("Unknown enum selector for variant " + //$NON-NLS-1$ definitionScope.getScopePath().getPath()); } Definition fieldValue = fDeclarationToPopulate.createDefinition(definitionScope, fieldName, input); diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFIOException.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFIOException.java new file mode 100644 index 0000000000..996c53b6fe --- /dev/null +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFIOException.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2015 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: Matthew Khouzam - Initial API and implementation + *******************************************************************************/ +package org.eclipse.tracecompass.ctf.core.trace; + +import org.eclipse.tracecompass.ctf.core.CTFException; + +/** + * An exception just for trace readers and writers + * + * @since 1.0 + */ +public class CTFIOException extends CTFException { + + /** + * Unique ID + */ + private static final long serialVersionUID = -2216400542574921838L; + + /** + * Constructor with an attached message. + * + * @param message + * The message attached to this exception + */ + public CTFIOException(String message) { + super(message); + } + + /** + * Constructor with an attached message. + * + * @param e + * The exception attached to this exception + */ + public CTFIOException(Exception e) { + super(e); + } + + /** + * Constructor with an attached message and exception. + * + * @param message + * The message attached to this exception + * @param e + * The encapsulated exception + * @since 1.0 + */ + public CTFIOException(String message, Exception e) { + super(message, e); + } + +} diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStream.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStream.java index 64b876f2d4..b687d7a269 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStream.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStream.java @@ -21,7 +21,7 @@ import java.util.Set; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration; import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration; import org.eclipse.tracecompass.ctf.core.event.types.IEventHeaderDeclaration; @@ -306,12 +306,12 @@ public class CTFStream { * * @param events * list of the events to add - * @throws CTFReaderException + * @throws CTFException * if the list already contains data */ - public void addEvents(Collection events) throws CTFReaderException { + public void addEvents(Collection events) throws CTFException { if (fEventUnsetId) { - throw new CTFReaderException("Cannot add to a stream with an unidentified event"); //$NON-NLS-1$ + throw new CTFException("Cannot add to a stream with an unidentified event"); //$NON-NLS-1$ } if (fEvents.isEmpty()) { fEvents.addAll(events); @@ -322,7 +322,7 @@ public class CTFStream { int index = event.getId().intValue(); ensureSize(fEvents, index); if (fEvents.get(index) != null) { - throw new CTFReaderException("Both lists have an event defined at position " + index); //$NON-NLS-1$ + throw new CTFException("Both lists have an event defined at position " + index); //$NON-NLS-1$ } fEvents.set(index, event); } diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInput.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInput.java index 0c8c6cbc1a..8698b72e82 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInput.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInput.java @@ -22,7 +22,7 @@ import java.util.UUID; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.scope.ILexicalScope; @@ -209,10 +209,10 @@ public class CTFStreamInput implements IDefinitionScope { * properly * * @return true if there are more packets to add - * @throws CTFReaderException + * @throws CTFException * If there was a problem reading the packed header */ - public boolean addPacketHeaderIndex() throws CTFReaderException { + public boolean addPacketHeaderIndex() throws CTFException { long currentPosBits = 0L; if (!fIndex.isEmpty()) { StreamInputPacketIndexEntry pos = fIndex.lastElement(); @@ -233,7 +233,7 @@ public class CTFStreamInput implements IDefinitionScope { } private StreamInputPacketIndexEntry createPacketIndexEntry(long dataOffsetbits) - throws CTFReaderException { + throws CTFException { try (FileChannel fc = FileChannel.open(fFile.toPath(), StandardOpenOption.READ)) { if (fc == null) { @@ -253,19 +253,19 @@ public class CTFStreamInput implements IDefinitionScope { /* Basic validation */ if (packetIndex.getContentSizeBits() > packetIndex.getPacketSizeBits()) { - throw new CTFReaderException("Content size > packet size"); //$NON-NLS-1$ + throw new CTFException("Content size > packet size"); //$NON-NLS-1$ } if (packetIndex.getPacketSizeBits() > ((size * Byte.SIZE - packetIndex.getOffsetBits()))) { - throw new CTFReaderException("Not enough data remaining in the file for the size of this packet"); //$NON-NLS-1$ + throw new CTFException("Not enough data remaining in the file for the size of this packet"); //$NON-NLS-1$ } return packetIndex; } catch (IOException e) { - throw new CTFReaderException("Failed to create packet index entry", e); //$NON-NLS-1$ + throw new CTFException("Failed to create packet index entry", e); //$NON-NLS-1$ } } - private BitBuffer createBitBufferForPacketHeader(FileChannel fc, long dataOffsetbits) throws CTFReaderException, IOException { + private BitBuffer createBitBufferForPacketHeader(FileChannel fc, long dataOffsetbits) throws CTFException, IOException { /* * create a packet bit buffer to read the packet header */ @@ -275,16 +275,16 @@ public class CTFStreamInput implements IDefinitionScope { return bitBuffer; } - private static ByteBuffer getByteBufferAt(FileChannel fc, long position, long size) throws CTFReaderException, IOException { + private static ByteBuffer getByteBufferAt(FileChannel fc, long position, long size) throws CTFException, IOException { ByteBuffer map = SafeMappedByteBuffer.map(fc, MapMode.READ_ONLY, position, size); if (map == null) { - throw new CTFReaderException("Failed to allocate mapped byte buffer"); //$NON-NLS-1$ + throw new CTFException("Failed to allocate mapped byte buffer"); //$NON-NLS-1$ } return map; } private static ByteBuffer createPacketBitBuffer(FileChannel fc, - long packetOffsetBytes, long maxSize) throws CTFReaderException, IOException { + long packetOffsetBytes, long maxSize) throws CTFException, IOException { /* * If there is less data remaining than what we want to map, reduce the * map size. @@ -305,12 +305,12 @@ public class CTFStreamInput implements IDefinitionScope { try { return getByteBufferAt(fc, packetOffsetBytes, mapSize); } catch (IllegalArgumentException | IOException e) { - throw new CTFReaderException(e); + throw new CTFException(e); } } private StructDefinition parseTracePacketHeader( - BitBuffer bitBuffer) throws CTFReaderException { + BitBuffer bitBuffer) throws CTFException { StructDefinition tracePacketHeaderDef = fTracePacketHeaderDecl.createDefinition(fStream.getTrace(), ILexicalScope.TRACE_PACKET_HEADER, bitBuffer); @@ -322,7 +322,7 @@ public class CTFStreamInput implements IDefinitionScope { if (magicDef != null) { int magic = (int) magicDef.getValue(); if (magic != Utils.CTF_MAGIC) { - throw new CTFReaderException( + throw new CTFException( "CTF magic mismatch " + Integer.toHexString(magic) + " vs " + Integer.toHexString(Utils.CTF_MAGIC)); //$NON-NLS-1$//$NON-NLS-2$ } } @@ -336,7 +336,7 @@ public class CTFStreamInput implements IDefinitionScope { UUID uuid = Utils.getUUIDfromDefinition(uuidDef); if (!getStream().getTrace().getUUID().equals(uuid)) { - throw new CTFReaderException("UUID mismatch"); //$NON-NLS-1$ + throw new CTFException("UUID mismatch"); //$NON-NLS-1$ } } @@ -349,14 +349,14 @@ public class CTFStreamInput implements IDefinitionScope { long streamID = streamIDDef.getValue(); if (streamID != getStream().getId()) { - throw new CTFReaderException("Stream ID changing within a StreamInput"); //$NON-NLS-1$ + throw new CTFException("Stream ID changing within a StreamInput"); //$NON-NLS-1$ } } return tracePacketHeaderDef; } private StreamInputPacketIndexEntry parsePacketContext(long dataOffsetBits, long fileSizeBytes, - BitBuffer bitBuffer) throws CTFReaderException { + BitBuffer bitBuffer) throws CTFException { StreamInputPacketIndexEntry packetIndex; StructDefinition streamPacketContextDef = fStreamPacketContextDecl.createDefinition(this, ILexicalScope.STREAM_PACKET_CONTEXT, bitBuffer); packetIndex = new StreamInputPacketIndexEntry(dataOffsetBits, streamPacketContextDef, fileSizeBytes, fLostSoFar); diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInputPacketReader.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInputPacketReader.java index 483cae8b40..d9e5da2499 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInputPacketReader.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInputPacketReader.java @@ -17,7 +17,7 @@ import java.nio.channels.FileChannel.MapMode; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.CTFStrings; import org.eclipse.tracecompass.ctf.core.event.EventDefinition; import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration; @@ -132,10 +132,10 @@ public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseab * @param input * the bitbuffer to read from * @return an context definition, can be null - * @throws CTFReaderException + * @throws CTFException * out of bounds exception or such */ - public StructDefinition getEventContextDefinition(@NonNull BitBuffer input) throws CTFReaderException { + public StructDefinition getEventContextDefinition(@NonNull BitBuffer input) throws CTFException { return fStreamEventContextDecl.createDefinition(fStreamInputReader.getStreamInput(), ILexicalScope.STREAM_EVENT_CONTEXT, input); } @@ -145,10 +145,10 @@ public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseab * @param input * the bitbuffer to read from * @return an context definition, can be null - * @throws CTFReaderException + * @throws CTFException * out of bounds exception or such */ - public StructDefinition getStreamPacketContextDefinition(@NonNull BitBuffer input) throws CTFReaderException { + public StructDefinition getStreamPacketContextDefinition(@NonNull BitBuffer input) throws CTFException { return fStreamPacketContextDecl.createDefinition(fStreamInputReader.getStreamInput(), ILexicalScope.STREAM_PACKET_CONTEXT, input); } @@ -158,10 +158,10 @@ public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseab * @param input * the bitbuffer to read from * @return an header definition, can be null - * @throws CTFReaderException + * @throws CTFException * out of bounds exception or such */ - public StructDefinition getTracePacketHeaderDefinition(@NonNull BitBuffer input) throws CTFReaderException { + public StructDefinition getTracePacketHeaderDefinition(@NonNull BitBuffer input) throws CTFException { return fTracePacketHeaderDecl.createDefinition(fStreamInputReader.getStreamInput().getStream().getTrace(), ILexicalScope.TRACE_PACKET_HEADER, input); } @@ -205,10 +205,10 @@ public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseab // ------------------------------------------------------------------------ @NonNull - private ByteBuffer getByteBufferAt(long position, long size) throws CTFReaderException, IOException { + private ByteBuffer getByteBufferAt(long position, long size) throws CTFException, IOException { ByteBuffer map = SafeMappedByteBuffer.map(fStreamInputReader.getFc(), MapMode.READ_ONLY, position, size); if (map == null) { - throw new CTFReaderException("Failed to allocate mapped byte buffer"); //$NON-NLS-1$ + throw new CTFIOException("Failed to allocate mapped byte buffer"); //$NON-NLS-1$ } return map; } @@ -218,10 +218,10 @@ public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseab * * @param currentPacket * The index entry of the packet to switch to. - * @throws CTFReaderException + * @throws CTFException * If we get an error reading the packet */ - void setCurrentPacket(StreamInputPacketIndexEntry currentPacket) throws CTFReaderException { + void setCurrentPacket(StreamInputPacketIndexEntry currentPacket) throws CTFException { StreamInputPacketIndexEntry prevPacket = null; fCurrentPacket = currentPacket; @@ -233,7 +233,7 @@ public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseab try { bb = getByteBufferAt(fCurrentPacket.getOffsetBytes(), (fCurrentPacket.getPacketSizeBits() + BITS_PER_BYTE - 1) / BITS_PER_BYTE); } catch (IOException e) { - throw new CTFReaderException(e.getMessage(), e); + throw new CTFIOException(e.getMessage(), e); } BitBuffer bitBuffer = new BitBuffer(bb); @@ -307,10 +307,10 @@ public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseab * * @return The event definition containing the event data that was just * read. - * @throws CTFReaderException + * @throws CTFException * If there was a problem reading the trace */ - public EventDefinition readNextEvent() throws CTFReaderException { + public EventDefinition readNextEvent() throws CTFException { /* Default values for those fields */ // compromise since we cannot have 64 bit addressing of arrays yet. int eventID = (int) EventDeclaration.UNSET_EVENT_ID; @@ -371,7 +371,7 @@ public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseab if (idDef instanceof SimpleDatatypeDefinition) { simpleIdDef = ((SimpleDatatypeDefinition) idDef); } else if (idDef != null) { - throw new CTFReaderException("Id defintion not an integer, enum or float definiton in event header."); //$NON-NLS-1$ + throw new CTFIOException("Id defintion not an integer, enum or float definiton in event header."); //$NON-NLS-1$ } /* @@ -414,7 +414,7 @@ public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseab /* Get the right event definition using the event id. */ IEventDeclaration eventDeclaration = fStreamInputReader.getStreamInput().getStream().getEventDeclaration(eventID); if (eventDeclaration == null) { - throw new CTFReaderException("Incorrect event id : " + eventID); //$NON-NLS-1$ + throw new CTFIOException("Incorrect event id : " + eventID); //$NON-NLS-1$ } EventDefinition eventDef = eventDeclaration.createDefinition(fStreamInputReader, currentBitBuffer, timestamp); @@ -424,7 +424,7 @@ public class CTFStreamInputPacketReader implements IDefinitionScope, AutoCloseab */ if (posStart == currentBitBuffer.position()) { - throw new CTFReaderException("Empty event not allowed, event: " + eventDef.getDeclaration().getName()); //$NON-NLS-1$ + throw new CTFIOException("Empty event not allowed, event: " + eventDef.getDeclaration().getName()); //$NON-NLS-1$ } return eventDef; diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInputReader.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInputReader.java index 7d43ca9eb4..bbcd64f999 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInputReader.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInputReader.java @@ -19,7 +19,7 @@ import java.nio.channels.FileChannel; import java.nio.file.StandardOpenOption; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.EventDefinition; import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration; import org.eclipse.tracecompass.ctf.core.event.types.StructDeclaration; @@ -82,10 +82,10 @@ public class CTFStreamInputReader implements AutoCloseable { * * @param streamInput * The StreamInput to read. - * @throws CTFReaderException + * @throws CTFException * If the file cannot be opened */ - public CTFStreamInputReader(CTFStreamInput streamInput) throws CTFReaderException { + public CTFStreamInputReader(CTFStreamInput streamInput) throws CTFException { if (streamInput == null) { throw new IllegalArgumentException("stream cannot be null"); //$NON-NLS-1$ } @@ -94,7 +94,7 @@ public class CTFStreamInputReader implements AutoCloseable { try { fFileChannel = FileChannel.open(fFile.toPath(), StandardOpenOption.READ); } catch (IOException e) { - throw new CTFReaderException(e); + throw new CTFIOException(e); } fPacketReader = new CTFStreamInputPacketReader(this); /* @@ -232,10 +232,10 @@ public class CTFStreamInputReader implements AutoCloseable { * Reads the next event in the current event variable. * * @return If an event has been successfully read. - * @throws CTFReaderException + * @throws CTFException * if an error occurs */ - public CTFResponse readNextEvent() throws CTFReaderException { + public CTFResponse readNextEvent() throws CTFException { /* * Change packet if needed @@ -263,10 +263,10 @@ public class CTFStreamInputReader implements AutoCloseable { /** * Change the current packet of the packet reader to the next one. * - * @throws CTFReaderException + * @throws CTFException * if an error occurs */ - private void goToNextPacket() throws CTFReaderException { + private void goToNextPacket() throws CTFException { fPacketIndex++; // did we already index the packet? if (getPacketSize() >= (fPacketIndex + 1)) { @@ -297,10 +297,10 @@ public class CTFStreamInputReader implements AutoCloseable { * @param timestamp * The timestamp to seek to. * @return The offset compared to the current position - * @throws CTFReaderException + * @throws CTFException * if an error occurs */ - public long seek(long timestamp) throws CTFReaderException { + public long seek(long timestamp) throws CTFException { long offset = 0; gotoPacket(timestamp); @@ -313,7 +313,7 @@ public class CTFStreamInputReader implements AutoCloseable { try { fStreamInput.addPacketHeaderIndex(); goToNextPacket(); - } catch (CTFReaderException e) { + } catch (CTFException e) { // do nothing here Activator.log(e.getMessage()); } @@ -344,10 +344,10 @@ public class CTFStreamInputReader implements AutoCloseable { /** * @param timestamp * the time to seek - * @throws CTFReaderException + * @throws CTFException * if an error occurs */ - private void gotoPacket(long timestamp) throws CTFReaderException { + private void gotoPacket(long timestamp) throws CTFException { fPacketIndex = fStreamInput.getIndex().search(timestamp) .previousIndex(); /* @@ -359,10 +359,10 @@ public class CTFStreamInputReader implements AutoCloseable { /** * Seeks the last event of a stream and returns it. * - * @throws CTFReaderException + * @throws CTFException * if an error occurs */ - public void goToLastEvent() throws CTFReaderException { + public void goToLastEvent() throws CTFException { /* * Search in the index for the packet to search in. */ diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java index 235618d7cd..dab79d1ad7 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java @@ -33,7 +33,7 @@ import java.util.Set; import java.util.TreeSet; import java.util.UUID; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.CTFCallsite; import org.eclipse.tracecompass.ctf.core.event.CTFClock; import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration; @@ -149,10 +149,10 @@ public class CTFTrace implements IDefinitionScope { * * @param path * Filesystem path of the trace directory - * @throws CTFReaderException + * @throws CTFException * If no CTF trace was found at the path */ - public CTFTrace(String path) throws CTFReaderException { + public CTFTrace(String path) throws CTFException { this(new File(path)); } @@ -161,20 +161,20 @@ public class CTFTrace implements IDefinitionScope { * * @param path * Filesystem path of the trace directory. - * @throws CTFReaderException + * @throws CTFException * If no CTF trace was found at the path */ - public CTFTrace(File path) throws CTFReaderException { + public CTFTrace(File path) throws CTFException { fPath = path; final Metadata metadata = new Metadata(this); /* Set up the internal containers for this trace */ if (!fPath.exists()) { - throw new CTFReaderException("Trace (" + path.getPath() + ") doesn't exist. Deleted or moved?"); //$NON-NLS-1$ //$NON-NLS-2$ + throw new CTFException("Trace (" + path.getPath() + ") doesn't exist. Deleted or moved?"); //$NON-NLS-1$ //$NON-NLS-2$ } if (!fPath.isDirectory()) { - throw new CTFReaderException("Path must be a valid directory"); //$NON-NLS-1$ + throw new CTFException("Path must be a valid directory"); //$NON-NLS-1$ } /* Open and parse the metadata file */ @@ -190,7 +190,7 @@ public class CTFTrace implements IDefinitionScope { fPath = null; } - private void init(File path) throws CTFReaderException { + private void init(File path) throws CTFException { /* Open all the trace files */ @@ -442,16 +442,16 @@ public class CTFTrace implements IDefinitionScope { * @param index * Which index in the class' streamFileChannel array this file * must use - * @throws CTFReaderException + * @throws CTFException * if there is a file error */ - private CTFStream openStreamInput(File streamFile) throws CTFReaderException { + private CTFStream openStreamInput(File streamFile) throws CTFException { ByteBuffer byteBuffer; BitBuffer streamBitBuffer; CTFStream stream; if (!streamFile.canRead()) { - throw new CTFReaderException("Unreadable file : " //$NON-NLS-1$ + throw new CTFException("Unreadable file : " //$NON-NLS-1$ + streamFile.getPath()); } @@ -470,7 +470,7 @@ public class CTFTrace implements IDefinitionScope { } } catch (IOException e) { /* Shouldn't happen at this stage if every other check passed */ - throw new CTFReaderException(e); + throw new CTFException(e); } if (fPacketHeaderDef != null) { validateMagicNumber(fPacketHeaderDef); @@ -495,7 +495,7 @@ public class CTFTrace implements IDefinitionScope { } if (stream == null) { - throw new CTFReaderException("Unexpected end of stream"); //$NON-NLS-1$ + throw new CTFException("Unexpected end of stream"); //$NON-NLS-1$ } /* @@ -507,22 +507,22 @@ public class CTFTrace implements IDefinitionScope { return stream; } - private void validateUUID(StructDefinition packetHeaderDef) throws CTFReaderException { + private void validateUUID(StructDefinition packetHeaderDef) throws CTFException { IDefinition lookupDefinition = packetHeaderDef.lookupDefinition("uuid"); //$NON-NLS-1$ ArrayDefinition uuidDef = (ArrayDefinition) lookupDefinition; if (uuidDef != null) { UUID otheruuid = Utils.getUUIDfromDefinition(uuidDef); if (!fUuid.equals(otheruuid)) { - throw new CTFReaderException("UUID mismatch"); //$NON-NLS-1$ + throw new CTFException("UUID mismatch"); //$NON-NLS-1$ } } } - private static void validateMagicNumber(StructDefinition packetHeaderDef) throws CTFReaderException { + private static void validateMagicNumber(StructDefinition packetHeaderDef) throws CTFException { IntegerDefinition magicDef = (IntegerDefinition) packetHeaderDef.lookupDefinition("magic"); //$NON-NLS-1$ int magic = (int) magicDef.getValue(); if (magic != Utils.CTF_MAGIC) { - throw new CTFReaderException("CTF magic mismatch"); //$NON-NLS-1$ + throw new CTFException("CTF magic mismatch"); //$NON-NLS-1$ } } @@ -564,10 +564,10 @@ public class CTFTrace implements IDefinitionScope { * * @param streamFile * the file of the stream - * @throws CTFReaderException + * @throws CTFException * A stream had an issue being read */ - public void addStreamFile(File streamFile) throws CTFReaderException { + public void addStreamFile(File streamFile) throws CTFException { openStreamInput(streamFile); } @@ -885,14 +885,14 @@ public class CTFTrace implements IDefinitionScope { * the ID of the stream * @param streamFile * new file in the stream - * @throws CTFReaderException + * @throws CTFException * The file must exist */ - public void addStream(long id, File streamFile) throws CTFReaderException { + public void addStream(long id, File streamFile) throws CTFException { CTFStream stream = null; final File file = streamFile; if (file == null) { - throw new CTFReaderException("cannot create a stream with no file"); //$NON-NLS-1$ + throw new CTFException("cannot create a stream with no file"); //$NON-NLS-1$ } if (fStreams.containsKey(id)) { stream = fStreams.get(id); diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTraceReader.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTraceReader.java index 1c4f940344..6286da118b 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTraceReader.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTraceReader.java @@ -21,7 +21,7 @@ import java.util.List; import java.util.PriorityQueue; import java.util.Set; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.EventDefinition; import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration; import org.eclipse.tracecompass.internal.ctf.core.Activator; @@ -87,10 +87,10 @@ public class CTFTraceReader implements AutoCloseable { * * @param trace * The trace to read from. - * @throws CTFReaderException + * @throws CTFException * if an error occurs */ - public CTFTraceReader(CTFTrace trace) throws CTFReaderException { + public CTFTraceReader(CTFTrace trace) throws CTFException { fTrace = trace; fStreamInputReaders.clear(); @@ -119,10 +119,10 @@ public class CTFTraceReader implements AutoCloseable { * Copy constructor * * @return The new CTFTraceReader - * @throws CTFReaderException + * @throws CTFException * if an error occurs */ - public CTFTraceReader copyFrom() throws CTFReaderException { + public CTFTraceReader copyFrom() throws CTFException { CTFTraceReader newReader = null; newReader = new CTFTraceReader(fTrace); @@ -189,10 +189,10 @@ public class CTFTraceReader implements AutoCloseable { /** * Creates one trace file reader per trace file contained in the trace. * - * @throws CTFReaderException + * @throws CTFException * if an error occurs */ - private void createStreamInputReaders() throws CTFReaderException { + private void createStreamInputReaders() throws CTFException { /* * For each stream. */ @@ -220,10 +220,10 @@ public class CTFTraceReader implements AutoCloseable { /** * Update the priority queue to make it match the parent trace * - * @throws CTFReaderException + * @throws CTFException * An error occured */ - public void update() throws CTFReaderException { + public void update() throws CTFException { Set readers = new HashSet<>(); for (CTFStream stream : fTrace.getStreams()) { Set streamInputs = stream.getStreamInputs(); @@ -271,10 +271,10 @@ public class CTFTraceReader implements AutoCloseable { * Initializes the priority queue used to choose the trace file with the * lower next event timestamp. * - * @throws CTFReaderException + * @throws CTFException * if an error occurs */ - private void populateStreamInputReaderHeap() throws CTFReaderException { + private void populateStreamInputReaderHeap() throws CTFException { if (fStreamInputReaders.isEmpty()) { fPrio = new PriorityQueue<>(MIN_PRIO_SIZE, new StreamInputReaderTimestampComparator()); @@ -325,10 +325,10 @@ public class CTFTraceReader implements AutoCloseable { * Go to the next event. * * @return True if an event was read. - * @throws CTFReaderException + * @throws CTFException * if an error occurs */ - public boolean advance() throws CTFReaderException { + public boolean advance() throws CTFException { /* * Remove the reader from the top of the priority queue. */ @@ -379,10 +379,10 @@ public class CTFTraceReader implements AutoCloseable { /** * Go to the last event in the trace. * - * @throws CTFReaderException + * @throws CTFException * if an error occurs */ - public void goToLastEvent() throws CTFReaderException { + public void goToLastEvent() throws CTFException { seek(getEndTime()); while (fPrio.size() > 1) { advance(); @@ -400,10 +400,10 @@ public class CTFTraceReader implements AutoCloseable { * the timestamp to seek to * @return true if there are events above or equal the seek timestamp, false * if seek at the end of the trace (no valid event). - * @throws CTFReaderException + * @throws CTFException * if an error occurs */ - public boolean seek(long timestamp) throws CTFReaderException { + public boolean seek(long timestamp) throws CTFException { /* * Remove all the trace readers from the priority queue */ diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/Metadata.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/Metadata.java index 5f132081a3..060fb5e5d1 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/Metadata.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/Metadata.java @@ -30,7 +30,7 @@ import org.antlr.runtime.CommonTokenStream; import org.antlr.runtime.RecognitionException; import org.antlr.runtime.tree.CommonTree; import org.antlr.runtime.tree.RewriteCardinalityException; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.parser.CTFLexer; import org.eclipse.tracecompass.ctf.parser.CTFParser; import org.eclipse.tracecompass.ctf.parser.CTFParser.parse_return; @@ -129,10 +129,10 @@ public class Metadata { /** * Parse the metadata file. * - * @throws CTFReaderException + * @throws CTFException * If there was a problem parsing the metadata */ - public void parseFile() throws CTFReaderException { + public void parseFile() throws CTFException { /* * Reader. It will contain a StringReader if we are using packet-based @@ -151,15 +151,15 @@ public class Metadata { readMetaDataText(metadataTextInput); } catch (FileNotFoundException e) { - throw new CTFReaderException("Cannot find metadata file!", e); //$NON-NLS-1$ + throw new CTFException("Cannot find metadata file!", e); //$NON-NLS-1$ } catch (IOException | ParseException e) { - throw new CTFReaderException(e); + throw new CTFException(e); } catch (RecognitionException | RewriteCardinalityException e) { throw new CtfAntlrException(e); } } - private Reader readBinaryMetaData(FileChannel metadataFileChannel) throws CTFReaderException { + private Reader readBinaryMetaData(FileChannel metadataFileChannel) throws CTFException { /* Create StringBuffer to receive metadata text */ StringBuffer metadataText = new StringBuffer(); @@ -183,17 +183,17 @@ public class Metadata { * * @param data * the data to read - * @throws CTFReaderException + * @throws CTFException * this exception wraps a ParseException, IOException or * CtfAntlrException, three exceptions that can be obtained from * parsing a TSDL file */ - public void parseText(String data) throws CTFReaderException { + public void parseText(String data) throws CTFException { Reader metadataTextInput = new StringReader(data); try { readMetaDataText(metadataTextInput); } catch (IOException | ParseException e) { - throw new CTFReaderException(e); + throw new CTFException(e); } catch (RecognitionException | RewriteCardinalityException e) { throw new CtfAntlrException(e); } @@ -213,17 +213,17 @@ public class Metadata { * * @param dataFragment * the data to read - * @throws CTFReaderException + * @throws CTFException * this exception wraps a ParseException, IOException or * CtfAntlrException, three exceptions that can be obtained from * parsing a TSDL file */ - public void parseTextFragment(String dataFragment) throws CTFReaderException { + public void parseTextFragment(String dataFragment) throws CTFException { Reader metadataTextInput = new StringReader(dataFragment); try { readMetaDataTextFragment(metadataTextInput); } catch (IOException | ParseException e) { - throw new CTFReaderException(e); + throw new CTFException(e); } catch (RecognitionException | RewriteCardinalityException e) { throw new CtfAntlrException(e); } @@ -258,10 +258,10 @@ public class Metadata { * @param metadataFileChannel * FileChannel of the metadata file. * @return True if the metadata is packet-based. - * @throws CTFReaderException + * @throws CTFException */ private boolean isPacketBased(FileChannel metadataFileChannel) - throws CTFReaderException { + throws CTFException { /* * Create a ByteBuffer to read the TSDL magic number (default is * big-endian) @@ -272,7 +272,7 @@ public class Metadata { try { metadataFileChannel.read(magicByteBuffer, 0); } catch (IOException e) { - throw new CTFReaderException("Unable to read metadata file channel.", e); //$NON-NLS-1$ + throw new CTFException("Unable to read metadata file channel.", e); //$NON-NLS-1$ } /* Get the first int from the file */ @@ -315,11 +315,11 @@ public class Metadata { * StringBuffer to which the metadata text will be appended. * @return A structure describing the header of the metadata packet, or null * if the end of the file is reached. - * @throws CTFReaderException + * @throws CTFException */ private MetadataPacketHeader readMetadataPacket( FileChannel metadataFileChannel, StringBuffer metadataText) - throws CTFReaderException { + throws CTFException { /* Allocate a ByteBuffer for the header */ ByteBuffer headerByteBuffer = ByteBuffer.allocate(METADATA_PACKET_HEADER_SIZE); @@ -333,11 +333,11 @@ public class Metadata { } if (nbBytesRead != METADATA_PACKET_HEADER_SIZE) { - throw new CTFReaderException("Error reading the metadata header."); //$NON-NLS-1$ + throw new CTFException("Error reading the metadata header."); //$NON-NLS-1$ } } catch (IOException e) { - throw new CTFReaderException("Error reading the metadata header.", e); //$NON-NLS-1$ + throw new CTFException("Error reading the metadata header.", e); //$NON-NLS-1$ } /* Set ByteBuffer's position to 0 */ @@ -350,20 +350,20 @@ public class Metadata { /* Check TSDL magic number */ if (!header.isMagicValid()) { - throw new CTFReaderException("TSDL magic number does not match"); //$NON-NLS-1$ + throw new CTFException("TSDL magic number does not match"); //$NON-NLS-1$ } /* Check UUID */ if (!trace.uuidIsSet()) { trace.setUUID(header.getUuid()); } else if (!trace.getUUID().equals(header.getUuid())) { - throw new CTFReaderException("UUID mismatch"); //$NON-NLS-1$ + throw new CTFException("UUID mismatch"); //$NON-NLS-1$ } /* Extract the text from the packet */ int payloadSize = ((header.getContentSize() / BITS_PER_BYTE) - METADATA_PACKET_HEADER_SIZE); if (payloadSize < 0) { - throw new CTFReaderException("Invalid metadata packet payload size."); //$NON-NLS-1$ + throw new CTFException("Invalid metadata packet payload size."); //$NON-NLS-1$ } int skipSize = (header.getPacketSize() - header.getContentSize()) / BITS_PER_BYTE; @@ -373,7 +373,7 @@ public class Metadata { try { metadataFileChannel.read(payloadByteBuffer); } catch (IOException e) { - throw new CTFReaderException("Error reading metadata packet payload.", e); //$NON-NLS-1$ + throw new CTFException("Error reading metadata packet payload.", e); //$NON-NLS-1$ } payloadByteBuffer.rewind(); diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/Utils.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/Utils.java index 9de9bd9137..a51f45e8dc 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/Utils.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/Utils.java @@ -14,7 +14,7 @@ package org.eclipse.tracecompass.ctf.core.trace; import java.util.UUID; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition; import org.eclipse.tracecompass.ctf.core.event.types.CompoundDeclaration; import org.eclipse.tracecompass.ctf.core.event.types.IDeclaration; @@ -104,33 +104,33 @@ public final class Utils { * @param uuidDef * the array defintions, must contain integer bytes * @return the UUID - * @throws CTFReaderException + * @throws CTFException * if the definition contains less than 16 elements */ - public static UUID getUUIDfromDefinition(AbstractArrayDefinition uuidDef) throws CTFReaderException { + public static UUID getUUIDfromDefinition(AbstractArrayDefinition uuidDef) throws CTFException { byte[] uuidArray = new byte[UUID_LEN]; IDeclaration declaration = uuidDef.getDeclaration(); if (!(declaration instanceof CompoundDeclaration)) { - throw new CTFReaderException("UUID must be a sequence of unsigned bytes"); //$NON-NLS-1$ + throw new CTFException("UUID must be a sequence of unsigned bytes"); //$NON-NLS-1$ } CompoundDeclaration uuidDec = (CompoundDeclaration) declaration; IDeclaration uuidElem = uuidDec.getElementType(); if (!(uuidElem instanceof IntegerDeclaration)) { - throw new CTFReaderException("UUID must be a sequence of unsigned bytes"); //$NON-NLS-1$ + throw new CTFException("UUID must be a sequence of unsigned bytes"); //$NON-NLS-1$ } IntegerDeclaration intUuidElem = (IntegerDeclaration) uuidElem; if (!intUuidElem.isUnsignedByte()) { - throw new CTFReaderException("UUID must be a sequence of unsigned bytes"); //$NON-NLS-1$ + throw new CTFException("UUID must be a sequence of unsigned bytes"); //$NON-NLS-1$ } return getUUID(uuidDef, uuidArray); } - private static UUID getUUID(AbstractArrayDefinition uuidDef, byte[] uuidArray) throws CTFReaderException { + private static UUID getUUID(AbstractArrayDefinition uuidDef, byte[] uuidArray) throws CTFException { for (int i = 0; i < uuidArray.length; i++) { IntegerDefinition uuidByteDef = (IntegerDefinition) uuidDef.getDefinitions().get(i); if (uuidByteDef == null) { - throw new CTFReaderException("UUID incomplete, only " + i + " bytes available"); //$NON-NLS-1$ //$NON-NLS-2$ + throw new CTFException("UUID incomplete, only " + i + " bytes available"); //$NON-NLS-1$ //$NON-NLS-2$ } uuidArray[i] = (byte) uuidByteDef.getValue(); } diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/EventDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/EventDeclaration.java index 9fbb31cae3..f0f0801a79 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/EventDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/EventDeclaration.java @@ -17,7 +17,7 @@ import java.util.Map; import java.util.Set; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.CTFStrings; import org.eclipse.tracecompass.ctf.core.event.EventDefinition; import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration; @@ -88,7 +88,7 @@ public class EventDeclaration implements IEventDeclaration { } @Override - public EventDefinition createDefinition(CTFStreamInputReader streamInputReader, @NonNull BitBuffer input, long timestamp) throws CTFReaderException { + public EventDefinition createDefinition(CTFStreamInputReader streamInputReader, @NonNull BitBuffer input, long timestamp) throws CTFException { StructDeclaration streamEventContextDecl = streamInputReader.getStreamEventContextDecl(); StructDefinition streamEventContext = streamEventContextDecl != null ? streamEventContextDecl.createDefinition(fStream.getTrace(), ILexicalScope.STREAM_EVENT_CONTEXT, input) : null; StructDefinition packetContext = streamInputReader.getPacketReader().getCurrentPacketEventHeader(); diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/metadata/exceptions/CtfAntlrException.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/metadata/exceptions/CtfAntlrException.java index bdcaeaceb7..d23fdc509a 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/metadata/exceptions/CtfAntlrException.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/metadata/exceptions/CtfAntlrException.java @@ -17,19 +17,19 @@ import java.lang.reflect.Field; import org.antlr.runtime.MismatchedTokenException; import org.antlr.runtime.RecognitionException; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.parser.CTFLexer; /** * CTF Reader exception but dealing with Antlr-specific parsing problems. * - * It is separated from the main {@link CTFReaderException} - and is not part of + * It is separated from the main {@link CTFException} - and is not part of * the API - to isolate the Antlr-specific classes and avoid pushing that * dependency to the users of this plugin. * * @author Matthew Khouzam */ -public class CtfAntlrException extends CTFReaderException { +public class CtfAntlrException extends CTFException { private static final long serialVersionUID = -7078624493350073777L; diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/ArrayDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/ArrayDeclaration.java index c871a47e51..b498aa7901 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/ArrayDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/ArrayDeclaration.java @@ -18,7 +18,7 @@ import java.util.List; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition; @@ -102,7 +102,7 @@ public final class ArrayDeclaration extends CompoundDeclaration { @Override public AbstractArrayDefinition createDefinition(@Nullable IDefinitionScope definitionScope, - @NonNull String fieldName, BitBuffer input) throws CTFReaderException { + @NonNull String fieldName, BitBuffer input) throws CTFException { alignRead(input); if (isString()) { byte[] data = new byte[fLength]; @@ -119,7 +119,7 @@ public final class ArrayDeclaration extends CompoundDeclaration { return "[declaration] array[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$ } - private @NonNull List read(@NonNull BitBuffer input, @Nullable IDefinitionScope definitionScope, String fieldName) throws CTFReaderException { + private @NonNull List read(@NonNull BitBuffer input, @Nullable IDefinitionScope definitionScope, String fieldName) throws CTFException { Builder definitions = new ImmutableList.Builder<>(); if (!fChildrenNames.containsKey(fieldName)) { for (int i = 0; i < fLength; i++) { diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/SequenceDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/SequenceDeclaration.java index bf4e6b9195..64796b4005 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/SequenceDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/SequenceDeclaration.java @@ -17,7 +17,7 @@ import java.util.Collection; import java.util.List; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.types.AbstractArrayDefinition; @@ -91,7 +91,7 @@ public class SequenceDeclaration extends CompoundDeclaration { @Override public AbstractArrayDefinition createDefinition( - @Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFReaderException { + @Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFException { IDefinition lenDef = null; if (definitionScope != null) { @@ -99,22 +99,22 @@ public class SequenceDeclaration extends CompoundDeclaration { } if (lenDef == null) { - throw new CTFReaderException("Sequence length field not found"); //$NON-NLS-1$ + throw new CTFException("Sequence length field not found"); //$NON-NLS-1$ } if (!(lenDef instanceof IntegerDefinition)) { - throw new CTFReaderException("Sequence length field not integer"); //$NON-NLS-1$ + throw new CTFException("Sequence length field not integer"); //$NON-NLS-1$ } IntegerDefinition lengthDefinition = (IntegerDefinition) lenDef; if (lengthDefinition.getDeclaration().isSigned()) { - throw new CTFReaderException("Sequence length must not be signed"); //$NON-NLS-1$ + throw new CTFException("Sequence length must not be signed"); //$NON-NLS-1$ } long length = lengthDefinition.getValue(); if ((length > Integer.MAX_VALUE) || (!input.canRead((int) length * fElemType.getMaximumSize()))) { - throw new CTFReaderException("Sequence length too long " + length); //$NON-NLS-1$ + throw new CTFException("Sequence length too long " + length); //$NON-NLS-1$ } if (isString()) { diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/composite/EventHeaderCompactDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/composite/EventHeaderCompactDeclaration.java index 86a7d8e3f7..4fb632479c 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/composite/EventHeaderCompactDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/composite/EventHeaderCompactDeclaration.java @@ -18,7 +18,7 @@ import java.util.List; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.types.Declaration; @@ -149,7 +149,7 @@ public final class EventHeaderCompactDeclaration extends Declaration implements } @Override - public EventHeaderDefinition createDefinition(@Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFReaderException { + public EventHeaderDefinition createDefinition(@Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFException { alignRead(input); ByteOrder bo = input.getByteOrder(); input.setByteOrder(fByteOrder); @@ -163,7 +163,7 @@ public final class EventHeaderCompactDeclaration extends Declaration implements input.position(input.position() + 3); long id = input.get(ID_SIZE, false); if (id > Integer.MAX_VALUE) { - throw new CTFReaderException("ID " + id + " larger than " + Integer.MAX_VALUE + " is currently unsupported by the parser"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + throw new CTFException("ID " + id + " larger than " + Integer.MAX_VALUE + " is currently unsupported by the parser"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ } long timestampLong = input.get(FULL_TS, false); input.setByteOrder(bo); diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/composite/EventHeaderLargeDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/composite/EventHeaderLargeDeclaration.java index facd9dff73..f1b722b2e5 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/composite/EventHeaderLargeDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/composite/EventHeaderLargeDeclaration.java @@ -18,7 +18,7 @@ import java.util.List; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.scope.IDefinitionScope; import org.eclipse.tracecompass.ctf.core.event.types.Declaration; @@ -176,7 +176,7 @@ public final class EventHeaderLargeDeclaration extends Declaration implements IE } @Override - public EventHeaderDefinition createDefinition(@Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFReaderException { + public EventHeaderDefinition createDefinition(@Nullable IDefinitionScope definitionScope, String fieldName, BitBuffer input) throws CTFException { alignRead(input); ByteOrder bo = input.getByteOrder(); input.setByteOrder(fByteOrder); @@ -189,7 +189,7 @@ public final class EventHeaderLargeDeclaration extends Declaration implements IE long timestampLong = input.get(FULL_TS, false); input.setByteOrder(bo); if (second > Integer.MAX_VALUE) { - throw new CTFReaderException("ID " + second + " larger than " + Integer.MAX_VALUE + " is currently unsupported by the parser"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + throw new CTFException("ID " + second + " larger than " + Integer.MAX_VALUE + " is currently unsupported by the parser"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ } return new EventHeaderDefinition(this, (int) second, timestampLong, FULL_TS); } diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/trace/StreamInputPacketIndex.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/trace/StreamInputPacketIndex.java index a05bb79fa9..3237ffb732 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/trace/StreamInputPacketIndex.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/trace/StreamInputPacketIndex.java @@ -26,7 +26,7 @@ import java.util.ListIterator; import java.util.TreeSet; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; /** * StreamInputPacketIndex @@ -76,11 +76,11 @@ public class StreamInputPacketIndex { * @param preParsedIndex * the pre-parsed index file * - * @throws CTFReaderException + * @throws CTFException * If there was a problem reading the entry */ public void appendAll(Collection preParsedIndex) - throws CTFReaderException { + throws CTFException { for (StreamInputPacketIndexEntry sipie : preParsedIndex) { append(checkNotNull(sipie)); } @@ -92,15 +92,15 @@ public class StreamInputPacketIndex { * @param entry * element to be appended to this index, cannot be null * @return {@code true} (as specified by {@link Collection#add}) - * @throws CTFReaderException + * @throws CTFException * If there was a problem reading the entry */ public boolean append(@NonNull StreamInputPacketIndexEntry entry) - throws CTFReaderException { + throws CTFException { /* Validate consistent entry. */ if (entry.getTimestampBegin() > entry.getTimestampEnd()) { - throw new CTFReaderException("Packet begin timestamp is after end timestamp"); //$NON-NLS-1$ + throw new CTFException("Packet begin timestamp is after end timestamp"); //$NON-NLS-1$ } /* @@ -108,7 +108,7 @@ public class StreamInputPacketIndex { * order. */ if (!fEntries.isEmpty() && (entry.getTimestampBegin() < lastElement().getTimestampBegin())) { - throw new CTFReaderException("Packets begin timestamp decreasing"); //$NON-NLS-1$ + throw new CTFException("Packets begin timestamp decreasing"); //$NON-NLS-1$ } fEntries.add(entry); diff --git a/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/event/CtfTmfEventFieldTest.java b/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/event/CtfTmfEventFieldTest.java index a1fd36de09..0a5100bccb 100644 --- a/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/event/CtfTmfEventFieldTest.java +++ b/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/event/CtfTmfEventFieldTest.java @@ -21,7 +21,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import org.eclipse.jdt.annotation.NonNull; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.io.BitBuffer; import org.eclipse.tracecompass.ctf.core.event.types.Encoding; import org.eclipse.tracecompass.ctf.core.event.types.EnumDeclaration; @@ -77,11 +77,11 @@ public class CtfTmfEventFieldTest { * * @throws UnsupportedEncodingException * Thrown when UTF-8 encoding is not available. - * @throws CTFReaderException + * @throws CTFException * error */ @Before - public void setUp() throws UnsupportedEncodingException, CTFReaderException { + public void setUp() throws UnsupportedEncodingException, CTFException { final byte[] testStringBytes = TEST_STRING.getBytes("UTF-8"); int capacity = 2048; diff --git a/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/internal/tmf/ctf/core/trace/iterator/CtfIterator.java b/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/internal/tmf/ctf/core/trace/iterator/CtfIterator.java index c4f71e4e66..7e3e213a59 100644 --- a/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/internal/tmf/ctf/core/trace/iterator/CtfIterator.java +++ b/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/internal/tmf/ctf/core/trace/iterator/CtfIterator.java @@ -15,7 +15,7 @@ package org.eclipse.tracecompass.internal.tmf.ctf.core.trace.iterator; import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.trace.CTFStreamInputReader; import org.eclipse.tracecompass.ctf.core.trace.CTFTrace; import org.eclipse.tracecompass.ctf.core.trace.CTFTraceReader; @@ -64,11 +64,11 @@ public class CtfIterator extends CTFTraceReader * * @param ctfTmfTrace * The {@link CtfTmfTrace} to iterate over - * @throws CTFReaderException + * @throws CTFException * If the iterator couldn't not be instantiated, probably due to * a read error. */ - public CtfIterator(CTFTrace ctfTrace, CtfTmfTrace ctfTmfTrace) throws CTFReaderException { + public CtfIterator(CTFTrace ctfTrace, CtfTmfTrace ctfTmfTrace) throws CTFException { super(ctfTrace); fTrace = ctfTmfTrace; if (hasMoreEvents()) { @@ -92,12 +92,12 @@ public class CtfIterator extends CTFTraceReader * The initial timestamp the iterator will be pointing to * @param rank * The initial rank - * @throws CTFReaderException + * @throws CTFException * If the iterator couldn't not be instantiated, probably due to * a read error. */ public CtfIterator(CTFTrace ctfTrace, CtfTmfTrace ctfTmfTrace, CtfLocationInfo ctfLocationData, long rank) - throws CTFReaderException { + throws CTFException { super(ctfTrace); this.fTrace = ctfTmfTrace; @@ -193,7 +193,7 @@ public class CtfIterator extends CTFTraceReader } else { ret = super.seek(offsetTimestamp); } - } catch (CTFReaderException e) { + } catch (CTFException e) { Activator.getDefault().logError(e.getMessage(), e); return false; } @@ -241,7 +241,7 @@ public class CtfIterator extends CTFTraceReader boolean ret = false; try { ret = super.advance(); - } catch (CTFReaderException e) { + } catch (CTFException e) { Activator.getDefault().logError(e.getMessage(), e); } diff --git a/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java b/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java index 5581924603..2329e007e7 100644 --- a/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java +++ b/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java @@ -33,7 +33,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.ctf.core.CTFReaderException; +import org.eclipse.tracecompass.ctf.core.CTFException; import org.eclipse.tracecompass.ctf.core.event.CTFCallsite; import org.eclipse.tracecompass.ctf.core.event.CTFClock; import org.eclipse.tracecompass.ctf.core.event.IEventDeclaration; @@ -188,7 +188,7 @@ public class CtfTmfTrace extends TmfTrace } } } - } catch (final CTFReaderException e) { + } catch (final CTFException e) { /* * If it failed at the init(), we can assume it's because the file * was not found or was not recognized as a CTF trace. Throw into @@ -234,7 +234,7 @@ public class CtfTmfTrace extends TmfTrace } } return new CtfTraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID, trace.getEnvironment()); - } catch (final CTFReaderException e) { + } catch (final CTFException e) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError + ": " + e.toString()); //$NON-NLS-1$ } catch (final BufferOverflowException e) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_ReadingError + ": " + Messages.CtfTmfTrace_BufferOverflowErrorMessage); //$NON-NLS-1$ @@ -525,7 +525,7 @@ public class CtfTmfTrace extends TmfTrace public ITmfContext createIterator() { try { return new CtfIterator(fTrace, this); - } catch (CTFReaderException e) { + } catch (CTFException e) { Activator.getDefault().logError(e.getMessage(), e); } return null; @@ -544,7 +544,7 @@ public class CtfTmfTrace extends TmfTrace public ITmfContext createIterator(CtfLocationInfo ctfLocationData, long rank) { try { return new CtfIterator(fTrace, this, ctfLocationData, rank); - } catch (CTFReaderException e) { + } catch (CTFException e) { Activator.getDefault().logError(e.getMessage(), e); } return null;