Failed

org.eclipse.jdt.core.tests.compiler.regression.ResourceLeakTests.testBug381445_2 - 1.8 (from org.eclipse.jdt.core.tests.compiler.regression.TestAll)

Failing for the past 4 builds (Since #6 )
Took 0.61 sec.

Error Message

testBug381445_2 - Eclipse found error(s) but Javac did not find any.
----------- Expected ------------

------------ but was ------------
----------\n
1. ERROR in Bug381445.java (at line 10)\n
 InputStream stream2 = new FileInputStream(path);\n
             ^^^^^^^\n
Potential resource leak: 'stream2' may not be closed\n
----------\n

--------- Difference is ----------
 expected:<[]> but was:<[----------\n
1. ERROR in Bug381445.java (at line 10)\n
 InputStream stream2 = new FileInputStream(path);\n
             ^^^^^^^\n
Potential resource leak: 'stream2' may not be closed\n
----------\n
]>

Stacktrace

junit.framework.ComparisonFailure: testBug381445_2 - Eclipse found error(s) but Javac did not find any.
----------- Expected ------------

------------ but was ------------
----------\n
1. ERROR in Bug381445.java (at line 10)\n
	InputStream stream2 = new FileInputStream(path);\n
	            ^^^^^^^\n
Potential resource leak: 'stream2' may not be closed\n
----------\n

--------- Difference is ----------
 expected:<[]> but was:<[----------\n
1. ERROR in Bug381445.java (at line 10)\n
	InputStream stream2 = new FileInputStream(path);\n
	            ^^^^^^^\n
Potential resource leak: 'stream2' may not be closed\n
----------\n
]>
	at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertStringEquals(TestCase.java:260)
	at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertEquals(TestCase.java:236)
	at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runJavac(AbstractRegressionTest.java:2044)
	at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runTest(AbstractRegressionTest.java:2814)
	at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runTest(AbstractRegressionTest.java:2539)
	at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runNegativeTest(AbstractRegressionTest.java:2301)
	at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runNegativeTest(AbstractRegressionTest.java:2289)
	at org.eclipse.jdt.core.tests.compiler.regression.ResourceLeakTests.testBug381445_2(ResourceLeakTests.java:4159)

Standard Output

org.eclipse.jdt.core.tests.compiler.regression.ResourceLeakTests#testBug381445_2 - 1.8
com/google/common/io/Closeables.java [
package com.google.common.io;
public class Closeables {
    public static void closeQuietly(java.io.Closeable closeable) {}
    public static void close(java.io.Closeable closeable, boolean flag) {}
}

]
Bug381445.java [
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import com.google.common.io.Closeables;

public class Bug381445 {
	public void readFile(String path) throws Exception {
		File file = new File(path);
		InputStream stream1 = new FileInputStream(path);
		InputStream stream2 = new FileInputStream(path);
		InputStream stream3 = new FileInputStream(path);
		try {
			// Use the opened streams here
			stream1.read();
			Closeables.closeQuietly(stream1);
			stream2.read();
			if (path.length() > 2)
				Closeables.closeQuietly(stream2);
			stream3.read();
		} finally {
		}
		Closeables.closeQuietly(stream3);
	}
}

]


Full results sent to /tmp/comptest/run.1514610271420/1.8.0_131_20171230_000432.txt

Standard Error

----------------------------------------