Failed

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

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

Error Message

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

------------ but was ------------
----------\n
1. ERROR in Bug396575.java (at line 11)\n
 bw = new BufferedWriter(writer);\n
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
Resource leak: 'bw' is never closed\n
----------\n
2. ERROR in Bug396575.java (at line 28)\n
 bw = new BufferedWriter(writer);\n
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
Resource leak: 'bw' is never closed\n
----------\n

--------- Difference is ----------
 expected:<[]> but was:<[----------\n
1. ERROR in Bug396575.java (at line 11)\n
 bw = new BufferedWriter(writer);\n
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
Resource leak: 'bw' is never closed\n
----------\n
2. ERROR in Bug396575.java (at line 28)\n
 bw = new BufferedWriter(writer);\n
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
Resource leak: 'bw' is never closed\n
----------\n
]>

Stacktrace

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

------------ but was ------------
----------\n
1. ERROR in Bug396575.java (at line 11)\n
	bw = new BufferedWriter(writer);\n
	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
Resource leak: 'bw' is never closed\n
----------\n
2. ERROR in Bug396575.java (at line 28)\n
	bw = new BufferedWriter(writer);\n
	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
Resource leak: 'bw' is never closed\n
----------\n

--------- Difference is ----------
 expected:<[]> but was:<[----------\n
1. ERROR in Bug396575.java (at line 11)\n
	bw = new BufferedWriter(writer);\n
	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
Resource leak: 'bw' is never closed\n
----------\n
2. ERROR in Bug396575.java (at line 28)\n
	bw = new BufferedWriter(writer);\n
	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
Resource leak: 'bw' is never 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:2220)
	at org.eclipse.jdt.core.tests.compiler.regression.ResourceLeakTests.testBug396575(ResourceLeakTests.java:5429)

Standard Output

org.eclipse.jdt.core.tests.compiler.regression.ResourceLeakTests#testBug396575 - 1.8
Bug396575.java [
import java.io.*;

public class Bug396575 {
  void test1(File myFile) {
   OutputStream out = null;
   BufferedWriter bw = null;
   try {
       // code...
       out = new FileOutputStream(myFile);
       OutputStreamWriter writer = new OutputStreamWriter(out);
       bw = new BufferedWriter(writer);
       // more code...
   } catch (Exception e) {
       try {
           bw.close(); // WARN: potential null pointer access
       } catch (Exception ignored) {}
       return;  // WARN: resource leak - bw may not be closed
   }
  }
  
  void test2(File myFile) {
       BufferedWriter bw = null;
   try {
       // code...
                                                       // declare "out" here inside try-catch as a temp variable
       OutputStream out = new FileOutputStream(myFile); // WARN: out is never closed.
       OutputStreamWriter writer = new OutputStreamWriter(out);
       bw = new BufferedWriter(writer);
       // more code...
   } catch (Exception e) {
       try {
           bw.close(); // WARN: potential null pointer access
       } catch (Exception ignored) {}
       return;  // WARN: resource leak - bw may not be closed
   }
  }
}

]


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

Standard Error

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