This does not hold any resources. A rule of thumb is "if and only if it ends in reader, it is autoclosable"
Change-Id: I5c02a139eeda663f0ef721151cb6cbc4206a0448
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/36371
Tested-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
new StructDeclaration(0),
null,
"packet",
- wrap( "field" ),
+ wrap("field"),
new Definition[] { new StringDefinition(new StringDeclaration(), null, "field", "test") }),
null)
);
*/
@Test(expected = CTFReaderException.class)
public void testStreamInputReader_invalid() throws CTFReaderException, IOException {
- try (CTFStreamInput streamInput = new CTFStreamInput(new CTFStream(new CTFTrace("")), new File(""));
- CTFStreamInputReader result = new CTFStreamInputReader(streamInput)) {
+ CTFStreamInput streamInput = new CTFStreamInput(new CTFStream(new CTFTrace("")), new File(""));
+ try (CTFStreamInputReader result = new CTFStreamInputReader(streamInput)) {
assertNotNull(result);
}
}
import java.io.File;
import java.io.FilenameFilter;
-import java.io.IOException;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
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.exceptions.ParseException;
-import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
fixture.addInput(fInput);
}
- @After
- public void tearDown() throws IOException {
- fInput.close();
- }
-
@NonNull
private static File createFile() {
File path = new File(testTrace.getPath());
*
* @since 3.0
*/
-// TODO: remove AutoCloseable
-public class CTFStreamInput implements IDefinitionScope, AutoCloseable {
+public class CTFStreamInput implements IDefinitionScope {
// ------------------------------------------------------------------------
// Attributes
fIndex = new StreamInputPacketIndex();
}
- @Override
- public void close() throws IOException {
- }
-
// ------------------------------------------------------------------------
// Getters/Setters/Predicates
// ------------------------------------------------------------------------
* The file must exist
* @since 3.0
*/
- // TODO: remove suppress warning
- @SuppressWarnings("resource")
public void addStream(long id, File streamFile) throws CTFReaderException {
CTFStream stream = null;
final File file = streamFile;