CTF: Remove autoclosable from CTFTrace
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Tue, 18 Nov 2014 19:12:44 +0000 (14:12 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Wed, 19 Nov 2014 00:37:23 +0000 (19:37 -0500)
Metadata is now autoclosable so the trace doesn't have to be.

Change-Id: I376c21f0888d57c55f41e83a15762c786a982b06
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/36367
Tested-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
13 files changed:
org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/TraceReadBenchmark.java
org.eclipse.tracecompass.ctf.core.tests/perf/org/eclipse/tracecompass/ctf/core/tests/perf/trace/TraceSeekBenchmark.java
org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/ctftestsuite/CtfTestSuiteTests.java
org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFStreamTest.java
org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceReaderTest.java
org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/CTFTraceTest.java
org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/IOstructgenTest.java
org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/trace/MetadataTest.java
org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/types/EventDeclarationTest.java
org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java
org.eclipse.tracecompass.lttng2.kernel.core/src/org/eclipse/tracecompass/lttng2/kernel/core/trace/LttngKernelTrace.java
org.eclipse.tracecompass.lttng2.ust.core/src/org/eclipse/tracecompass/lttng2/ust/core/trace/LttngUstTrace.java
org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java

index 5b4c8b509758fea0eeed26ad82ea012310d25286..49b6732c14c79cb40f6179510c52b92b2cf8f070 100644 (file)
@@ -67,16 +67,17 @@ public class TraceReadBenchmark {
 
         for (int loop = 0; loop < LOOP_COUNT; loop++) {
             pm.start();
-            try (CTFTrace trace = testTrace.getTrace();
-                    CTFTraceReader traceReader = new CTFTraceReader(trace);) {
+            try {
+                CTFTrace trace = testTrace.getTrace();
+                try (CTFTraceReader traceReader = new CTFTraceReader(trace);) {
 
-                while (traceReader.hasMoreEvents()) {
-                    EventDefinition ed = traceReader.getCurrentEventDef();
-                    /* Do something with the event */
-                    ed.getCPU();
-                    traceReader.advance();
+                    while (traceReader.hasMoreEvents()) {
+                        EventDefinition ed = traceReader.getCurrentEventDef();
+                        /* Do something with the event */
+                        ed.getCPU();
+                        traceReader.advance();
+                    }
                 }
-
             } catch (CTFReaderException e) {
                 /* Should not happen if assumeTrue() passed above */
                 fail("Test failed at iteration " + loop + ':' + e.getMessage());
index 05020138e8d1fead58bf1103037a9ddddbfbd7d3..ca6c5a64c11375b7db06c92f636f0ad079d663bd 100644 (file)
@@ -32,14 +32,13 @@ import org.junit.Test;
 
 /**
  * Tests for performance regressions of the ctf reader. It only tests the ctf
- * reader, not tmf.
- * <br>
+ * reader, not tmf. <br>
  * This test runs in 3 passes.
  * <ul>
  * <li>first it opens a trace</li>
  * <li>then it reads the trace completely</li>
- * <li>then it randomly (seeded) seeks NB_SEEKS locations in the trace and reads one
- * event at each position.</li>
+ * <li>then it randomly (seeded) seeks NB_SEEKS locations in the trace and reads
+ * one event at each position.</li>
  * </ul>
  *
  * @author Matthew Khouzam
@@ -56,13 +55,16 @@ public class TraceSeekBenchmark {
 
     /**
      * Run the benchmark scenario for the trace "kernel"
+     *
+     * @throws CTFReaderException
+     *             Should not happen
      */
     @Test
-    public void testKernelTrace() {
+    public void testKernelTrace() throws CTFReaderException {
         readAndSeekTrace(CtfTestTrace.KERNEL, "trace-kernel", true);
     }
 
-    private static void readAndSeekTrace(CtfTestTrace testTrace, String testName, boolean inGlobalSummary) {
+    private static void readAndSeekTrace(CtfTestTrace testTrace, String testName, boolean inGlobalSummary) throws CTFReaderException {
         assumeTrue(testTrace.exists());
 
         Performance perf = Performance.getDefault();
@@ -74,8 +76,8 @@ public class TraceSeekBenchmark {
         }
 
         for (int loop = 0; loop < LOOP_COUNT; loop++) {
-            try (CTFTrace trace = testTrace.getTrace();
-                    CTFTraceReader traceReader = new CTFTraceReader(trace);) {
+            CTFTrace trace = testTrace.getTrace();
+            try (CTFTraceReader traceReader = new CTFTraceReader(trace);) {
 
                 /* Read the whole trace to find out the start and end times */
                 EventDefinition firstEvent = traceReader.getCurrentEventDef();
index c59f310ab15e273eaa07438474565fe8296494eb..8ca87bad84556b50ba99cba0b20e6ecb74b741a6 100644 (file)
@@ -178,17 +178,19 @@ public class CtfTestSuiteTests {
      */
     @Test
     public void testTrace() {
-        try (/* Instantiate the trace (which implies parsing the metadata) */
-                CTFTrace trace = new CTFTrace(fTracePath);
-                /* Read the trace until the end */
-                CTFTraceReader reader = new CTFTraceReader(trace);) {
-
-            reader.getCurrentEventDef();
-            while (reader.advance()) {
-                assertNotNull(reader.getCurrentEventDef());
-            }
+        try {
+            /* Instantiate the trace (which implies parsing the metadata) */
+            CTFTrace trace = new CTFTrace(fTracePath);
+            /* Read the trace until the end */
+            try (CTFTraceReader reader = new CTFTraceReader(trace);) {
+
+                reader.getCurrentEventDef();
+                while (reader.advance()) {
+                    assertNotNull(reader.getCurrentEventDef());
+                }
 
-            checkIfWeShoudlSucceed();
+                checkIfWeShoudlSucceed();
+            }
         } catch (CTFReaderException e) {
             checkIfWeShouldFail(e);
         } catch (OutOfMemoryError e) {
index 8dc4bde13ac704ac458d06248c764da2feb34c38..310e0117e6827fbdb13476a03ffaecd7b167862d 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013 Ericsson
+ * Copyright (c) 2013, 2014 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
@@ -102,10 +102,9 @@ public class CTFStreamTest {
      */
     @Test
     public void testStream() throws CTFReaderException {
-        try (CTFTrace trace = testTrace.getTrace()) {
-            CTFStream result = new CTFStream(trace);
-            assertNotNull(result);
-        }
+        CTFTrace trace = testTrace.getTrace();
+        CTFStream result = new CTFStream(trace);
+        assertNotNull(result);
     }
 
     /**
@@ -200,9 +199,8 @@ public class CTFStreamTest {
      */
     @Test
     public void testGetTrace() {
-        try (CTFTrace result = fixture.getTrace();) {
-            assertNotNull(result);
-        }
+        CTFTrace result = fixture.getTrace();
+        assertNotNull(result);
     }
 
     /**
index b61fdc793ad2756961beef022b084d6569da3cdc..009a99eb49370529c032887dd104a1ae6ddcf72e 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013 Ericsson
+ * Copyright (c) 2013, 2014 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
@@ -58,8 +58,8 @@ public class CTFTraceReaderTest {
      */
     @Test
     public void testOpen_existing() throws CTFReaderException {
-        try (CTFTrace trace = testTrace.getTrace();
-                CTFTraceReader result = new CTFTraceReader(trace);) {
+        CTFTrace trace = testTrace.getTrace();
+        try (CTFTraceReader result = new CTFTraceReader(trace);) {
             assertNotNull(result);
         }
     }
@@ -72,8 +72,8 @@ public class CTFTraceReaderTest {
      */
     @Test(expected = org.eclipse.tracecompass.ctf.core.trace.CTFReaderException.class)
     public void testOpen_nonexisting() throws CTFReaderException {
-        try (CTFTrace trace = new CTFTrace("badfile.bad");
-                CTFTraceReader result = new CTFTraceReader(trace);) {
+        CTFTrace trace = new CTFTrace("badfile.bad");
+        try (CTFTraceReader result = new CTFTraceReader(trace);) {
             assertNotNull(result);
         }
     }
@@ -86,15 +86,17 @@ public class CTFTraceReaderTest {
      */
     @Test(expected = org.eclipse.tracecompass.ctf.core.trace.CTFReaderException.class)
     public void testOpen_invalid() throws CTFReaderException {
-        try (CTFTrace trace = new CTFTrace("");
-                CTFTraceReader result = new CTFTraceReader(trace);) {
+        CTFTrace trace = new CTFTrace("");
+        try (CTFTraceReader result = new CTFTraceReader(trace);) {
             assertNotNull(result);
         }
     }
 
     /**
      * Run the boolean advance() method test. Test advancing normally.
-     * @throws CTFReaderException error
+     *
+     * @throws CTFReaderException
+     *             error
      */
     @Test
     public void testAdvance_normal() throws CTFReaderException {
@@ -105,7 +107,9 @@ 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 error
+     *
+     * @throws CTFReaderException
+     *             error
      */
     @Test
     public void testAdvance_end() throws CTFReaderException {
@@ -130,7 +134,9 @@ public class CTFTraceReaderTest {
 
     /**
      * Run the CTFTraceReader copy constructor test.
-     * @throws CTFReaderException error
+     *
+     * @throws CTFReaderException
+     *             error
      */
     @Test
     public void testCopyFrom() throws CTFReaderException {
@@ -177,7 +183,9 @@ public class CTFTraceReaderTest {
     /**
      * Run the getCurrentEventDef() method test. Get the last event's
      * definition.
-     * @throws CTFReaderException error
+     *
+     * @throws CTFReaderException
+     *             error
      */
     @Test
     public void testGetCurrentEventDef_last() throws CTFReaderException {
@@ -206,7 +214,9 @@ public class CTFTraceReaderTest {
 
     /**
      * Run the void goToLastEvent() method test.
-     * @throws CTFReaderException error
+     *
+     * @throws CTFReaderException
+     *             error
      */
     @Test
     public void testGoToLastEvent() throws CTFReaderException {
@@ -229,7 +239,9 @@ public class CTFTraceReaderTest {
 
     /**
      * Run the void printStats() method test with no 'width' parameter.
-     * @throws CTFReaderException error
+     *
+     * @throws CTFReaderException
+     *             error
      */
     @Test
     public void testPrintStats_noparam() throws CTFReaderException {
@@ -239,7 +251,9 @@ public class CTFTraceReaderTest {
 
     /**
      * Run the void printStats(int) method test with width = 0.
-     * @throws CTFReaderException error
+     *
+     * @throws CTFReaderException
+     *             error
      */
     @Test
     public void testPrintStats_width0() throws CTFReaderException {
@@ -249,7 +263,9 @@ public class CTFTraceReaderTest {
 
     /**
      * Run the void printStats(int) method test with width = 1.
-     * @throws CTFReaderException error
+     *
+     * @throws CTFReaderException
+     *             error
      */
     @Test
     public void testPrintStats_width1() throws CTFReaderException {
@@ -259,7 +275,9 @@ public class CTFTraceReaderTest {
 
     /**
      * Run the void printStats(int) method test with width = 2.
-     * @throws CTFReaderException error
+     *
+     * @throws CTFReaderException
+     *             error
      */
     @Test
     public void testPrintStats_width2() throws CTFReaderException {
@@ -269,7 +287,9 @@ public class CTFTraceReaderTest {
 
     /**
      * Run the void printStats(int) method test with width = 10.
-     * @throws CTFReaderException error
+     *
+     * @throws CTFReaderException
+     *             error
      */
     @Test
     public void testPrintStats_width10() throws CTFReaderException {
@@ -279,7 +299,9 @@ public class CTFTraceReaderTest {
 
     /**
      * Run the void printStats(int) method test with width = 100.
-     * @throws CTFReaderException error
+     *
+     * @throws CTFReaderException
+     *             error
      */
     @Test
     public void testPrintStats_100() throws CTFReaderException {
@@ -291,7 +313,9 @@ public class CTFTraceReaderTest {
 
     /**
      * Run the boolean seek(long) method test.
-     * @throws CTFReaderException error
+     *
+     * @throws CTFReaderException
+     *             error
      */
     @Test
     public void testSeek() throws CTFReaderException {
@@ -300,8 +324,6 @@ public class CTFTraceReaderTest {
         assertTrue(result);
     }
 
-
-
     /**
      * @return
      */
index b0447031a10b3a584df9c5b9bdc4cd717e8dcff0..cddd93da14cf6fcbdd8418af68b0e19e9cb8b45b 100644 (file)
@@ -72,7 +72,8 @@ public class CTFTraceTest {
      */
     @Test
     public void testOpen_existing() {
-        try (CTFTrace result = testTrace.getTraceFromFile();) {
+        try {
+            CTFTrace result = testTrace.getTraceFromFile();
             assertNotNull(result.getUUID());
         } catch (CTFReaderException e) {
             fail();
@@ -88,9 +89,8 @@ public class CTFTraceTest {
     @Test(expected = org.eclipse.tracecompass.ctf.core.trace.CTFReaderException.class)
     public void testOpen_invalid() throws CTFReaderException {
         File path = new File("");
-        try (CTFTrace result = new CTFTrace(path);) {
-            assertNotNull(result);
-        }
+        CTFTrace result = new CTFTrace(path);
+        assertNotNull(result);
     }
 
     /**
@@ -252,10 +252,14 @@ public class CTFTraceTest {
      */
     @Test
     public void testPacketHeaderIsSet_invalid() {
-        try (CTFTrace fixture2 = testTrace.getTraceFromFile();){
+        try {
+            CTFTrace fixture2 = testTrace.getTraceFromFile();
             fixture2.setMinor(1L);
             fixture2.setUUID(UUID.randomUUID());
-            fixture2.setPacketHeader((StructDeclaration) null); /* it's null here! */
+            /*
+             * it's null here!
+             */
+            fixture2.setPacketHeader((StructDeclaration) null);
             fixture2.setMajor(1L);
             fixture2.setByteOrder(ByteOrder.BIG_ENDIAN);
 
@@ -385,26 +389,26 @@ public class CTFTraceTest {
 
     /**
      * Test for getCallsite(eventName, ip)
-     * @throws CTFReaderException not expected
+     *
+     * @throws CTFReaderException
+     *             not expected
      */
     @Test
     public void callsitePosition() throws CTFReaderException {
         long ip1 = 2;
         long ip2 = 5;
         long ip3 = 7;
-        try (CTFTrace callsiteTest = testTrace.getTraceFromFile()) {
-            callsiteTest.addCallsite("testEvent", null, ip1, null, 23);
-            callsiteTest.addCallsite("testEvent", null, ip2, null, 50);
-            callsiteTest.addCallsite("testEvent", null, ip3, null, 15);
-
-            assertEquals(2, (callsiteTest.getCallsite("testEvent", 1)).getIp());
-            assertEquals(2, (callsiteTest.getCallsite("testEvent", 2)).getIp());
-            assertEquals(5, (callsiteTest.getCallsite("testEvent", 3)).getIp());
-            assertEquals(5, (callsiteTest.getCallsite("testEvent", 5)).getIp());
-            assertEquals(7, (callsiteTest.getCallsite("testEvent", 6)).getIp());
-            assertEquals(7, (callsiteTest.getCallsite("testEvent", 7)).getIp());
-            assertEquals(7, (callsiteTest.getCallsite("testEvent", 8)).getIp());
-        }
+        CTFTrace callsiteTest = testTrace.getTraceFromFile();
+        callsiteTest.addCallsite("testEvent", null, ip1, null, 23);
+        callsiteTest.addCallsite("testEvent", null, ip2, null, 50);
+        callsiteTest.addCallsite("testEvent", null, ip3, null, 15);
+
+        assertEquals(2, (callsiteTest.getCallsite("testEvent", 1)).getIp());
+        assertEquals(2, (callsiteTest.getCallsite("testEvent", 2)).getIp());
+        assertEquals(5, (callsiteTest.getCallsite("testEvent", 3)).getIp());
+        assertEquals(5, (callsiteTest.getCallsite("testEvent", 5)).getIp());
+        assertEquals(7, (callsiteTest.getCallsite("testEvent", 6)).getIp());
+        assertEquals(7, (callsiteTest.getCallsite("testEvent", 7)).getIp());
+        assertEquals(7, (callsiteTest.getCallsite("testEvent", 8)).getIp());
     }
-
 }
index 5e6f5b22b42dba9a3bc2af29ef4501f141d3819d..f8ff7cba9b918ac63786e581517a93ecc0d82b2d 100644 (file)
@@ -30,7 +30,6 @@ import org.eclipse.tracecompass.ctf.core.trace.CTFReaderException;
 import org.eclipse.tracecompass.ctf.core.trace.CTFTrace;
 import org.eclipse.tracecompass.internal.ctf.core.event.EventDeclaration;
 import org.eclipse.tracecompass.internal.ctf.core.event.metadata.IOStructGen;
-import org.junit.After;
 import org.junit.Test;
 
 /**
@@ -413,14 +412,6 @@ public class IOstructgenTest {
 
     }
 
-    /**
-     * Close trace
-     */
-    @After
-    public void tearDown(){
-        trace.close();
-    }
-
     /**
      * Simple test (only the minimum)
      *
index 79e3e876839529c0b7cff0b290c14990f46bb648..f02e8b9da2861c65f20426ba8572da91c991a0b2 100644 (file)
@@ -207,12 +207,11 @@ public class MetadataTest {
 
     @Test
     public void testStreamTextMD() throws CTFReaderException {
-        try (CTFTrace trace = testSingleFragment();) {
-            fixture.parseTextFragment(mdSecond);
-            final List<IEventDeclaration> eventDeclarations = new ArrayList<>(trace.getEventDeclarations(0L));
-            assertEquals(2, eventDeclarations.size());
-            assertEquals("bozo_the_clown", eventDeclarations.get(1).getName());
-        }
+        CTFTrace trace = testSingleFragment();
+        fixture.parseTextFragment(mdSecond);
+        final List<IEventDeclaration> eventDeclarations = new ArrayList<>(trace.getEventDeclarations(0L));
+        assertEquals(2, eventDeclarations.size());
+        assertEquals("bozo_the_clown", eventDeclarations.get(1).getName());
     }
 
     /**
index a7382abc5dc07124af10e21035751f34e974cf29..622422ae9450627fef692748e32dc151a416a5eb 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013 Ericsson
+ * Copyright (c) 2013, 2014 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
@@ -217,7 +217,7 @@ public class EventDeclarationTest {
      */
     @Test
     public void testGetId() {
-        assertEquals(1,fixture.id());
+        assertEquals(1, fixture.id());
     }
 
     /**
@@ -315,59 +315,57 @@ public class EventDeclarationTest {
      */
     @Test
     public void testEventDefinition() throws CTFReaderException {
-        try (CTFTrace trace = testTrace.getTrace();) {
-            EventDefinition ed = null;
-            try (CTFTraceReader tr = new CTFTraceReader(trace);) {
-                tr.advance();
-                ed = tr.getCurrentEventDef();
-            }
-
-            assertNotNull(ed);
-            assertNotNull(ed.getScopePath());
-            assertNotNull(ed.getDeclaration());
-            assertNotNull(ed.getFields());
-            assertNull(ed.getContext());
-            assertNotNull(ed.getPacketContext());
-            assertNotNull(ed.getCPU());
-            assertNotNull(ed.getStreamInputReader());
-            assertNull(ed.lookupDefinition("context"));
-            assertNotNull(ed.lookupDefinition("fields"));
-            assertNull(ed.lookupDefinition("other"));
-            assertNotNull(ed.toString());
+        CTFTrace trace = testTrace.getTrace();
+        EventDefinition ed = null;
+        try (CTFTraceReader tr = new CTFTraceReader(trace);) {
+            tr.advance();
+            ed = tr.getCurrentEventDef();
         }
+
+        assertNotNull(ed);
+        assertNotNull(ed.getScopePath());
+        assertNotNull(ed.getDeclaration());
+        assertNotNull(ed.getFields());
+        assertNull(ed.getContext());
+        assertNotNull(ed.getPacketContext());
+        assertNotNull(ed.getCPU());
+        assertNotNull(ed.getStreamInputReader());
+        assertNull(ed.lookupDefinition("context"));
+        assertNotNull(ed.lookupDefinition("fields"));
+        assertNull(ed.lookupDefinition("other"));
+        assertNotNull(ed.toString());
     }
 
     EventDeclaration e1;
     EventDeclaration e2;
 
-
     @Test
-    public void testEquals1(){
+    public void testEquals1() {
         e1 = new EventDeclaration();
         assertFalse(e1.equals(null));
     }
 
     @Test
-    public void testEquals2(){
+    public void testEquals2() {
         e1 = EventDeclaration.getLostEventDeclaration();
         assertFalse(e1.equals(new Long(23L)));
     }
 
     @Test
-    public void testEquals3(){
+    public void testEquals3() {
         e1 = EventDeclaration.getLostEventDeclaration();
-        assertEquals(e1,e1);
+        assertEquals(e1, e1);
     }
 
     @Test
-    public void testEquals4(){
+    public void testEquals4() {
         e1 = EventDeclaration.getLostEventDeclaration();
         e2 = EventDeclaration.getLostEventDeclaration();
-        assertEquals(e1,e2);
+        assertEquals(e1, e2);
     }
 
     @Test
-    public void testEquals5(){
+    public void testEquals5() {
         e1 = EventDeclaration.getLostEventDeclaration();
         e2 = new EventDeclaration();
         assertFalse(e1.equals(e2));
index c92b7625467b05f09f9440e4553f60f2b3e3b6bd..2c48a4959dd81c5bf479a894b41ffc627e7619e7 100644 (file)
@@ -60,7 +60,7 @@ import org.eclipse.tracecompass.internal.ctf.core.event.types.ArrayDefinition;
  * @author Matthew Khouzam
  * @version $Revision: 1.0 $
  */
-public class CTFTrace implements IDefinitionScope, AutoCloseable {
+public class CTFTrace implements IDefinitionScope {
 
     @Override
     public String toString() {
@@ -214,17 +214,6 @@ public class CTFTrace implements IDefinitionScope, AutoCloseable {
         }
     }
 
-    /**
-     * Dispose the trace
-     *
-     * FIXME Not needed anymore, class doesn't need to be AutoCloseable.
-     *
-     * @since 3.0
-     */
-    @Override
-    public void close() {
-    }
-
     // ------------------------------------------------------------------------
     // Getters/Setters/Predicates
     // ------------------------------------------------------------------------
index c818492ceecffe9066062740af3956379a29e443..a58269f38a3f70cd6999438e3e8e523fb6d1c8b0 100644 (file)
@@ -126,7 +126,8 @@ public class LttngKernelTrace extends CtfTmfTrace {
          * Make sure the trace is openable as a CTF trace. We do this here
          * instead of calling super.validate() to keep the reference to "temp".
          */
-        try (CTFTrace temp = new CTFTrace(path);) {
+        try {
+            CTFTrace temp = new CTFTrace(path);
             /* Make sure the domain is "kernel" in the trace's env vars */
             String dom = temp.getEnvironment().get("domain"); //$NON-NLS-1$
             if (dom != null && dom.startsWith("\"kernel")) { //$NON-NLS-1$
index 8f5e16e658f649e9a0710ea72ce749f914c114a9..8ec2552eff429088c6e3584d0f9d6d784c84dd45 100644 (file)
@@ -49,8 +49,9 @@ public class LttngUstTrace extends CtfTmfTrace {
      * CTF trace in the "ust" domain.
      */
     @Override
-    public IStatus validate(final IProject project, final String path)  {
-        try (CTFTrace temp = new CTFTrace(path);) {
+    public IStatus validate(final IProject project, final String path) {
+        try {
+            CTFTrace temp = new CTFTrace(path);
             /* Make sure the domain is "ust" in the trace's env vars */
             String dom = temp.getEnvironment().get("domain"); //$NON-NLS-1$
             if (dom != null && dom.equals("\"ust\"")) { //$NON-NLS-1$
index f1d142d231c03eacc57e52dcfb1715155f9f779f..b3ee8e242c303ef84f68b6ac2738de327a8ceb5a 100644 (file)
@@ -193,7 +193,6 @@ public class CtfTmfTrace extends TmfTrace
     public synchronized void dispose() {
         fIteratorManager.dispose();
         if (fTrace != null) {
-            fTrace.close();
             fTrace = null;
         }
         super.dispose();
@@ -208,7 +207,8 @@ public class CtfTmfTrace extends TmfTrace
     @Override
     public IStatus validate(final IProject project, final String path) {
         IStatus status = new TraceValidationStatus(CONFIDENCE, Activator.PLUGIN_ID);
-        try (final CTFTrace temp = new CTFTrace(path);) {
+        try {
+            final CTFTrace temp = new CTFTrace(path);
             if (!temp.majorIsSet()) {
                 status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.CtfTmfTrace_MajorNotSet);
             } else {
@@ -527,7 +527,8 @@ public class CtfTmfTrace extends TmfTrace
             sessionName = getResource().getPersistentProperty(CtfConstants.LIVE_SESSION_NAME);
         } catch (CoreException e) {
             Activator.getDefault().logError(e.getMessage(), e);
-            // Something happened to the resource, assume we won't get any more data from it
+            // Something happened to the resource, assume we won't get any more
+            // data from it
             return true;
         }
         return host == null || port == null || sessionName == null;
This page took 0.035692 seconds and 5 git commands to generate.