Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2015-12-01 11:08:09 -0500
committerMarkus Keller2015-12-01 11:08:09 -0500
commit7e4ccad828f771ba6f03bf5c585ba5779d2bacdc (patch)
tree03b76b849af8d95c448ebbab5434ce1c06ab72bb /org.eclipse.jface.text.tests
parent96da92a20589d62dad534245c5d9c4d45618ee95 (diff)
downloadeclipse.platform.text-7e4ccad828f771ba6f03bf5c585ba5779d2bacdc.tar.gz
eclipse.platform.text-7e4ccad828f771ba6f03bf5c585ba5779d2bacdc.tar.xz
eclipse.platform.text-7e4ccad828f771ba6f03bf5c585ba5779d2bacdc.zip
follow-up to bug 478673: fixed resource leaks
Diffstat (limited to 'org.eclipse.jface.text.tests')
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java
index 60f8e0dbc..ef1c09d6c 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/HTML2TextReaderTest.java
@@ -56,8 +56,10 @@ public class HTML2TextReaderTest extends TestCase {
private void verify(String input, String expectedOutput, int styleRangeCount) throws IOException {
Reader reader= new StringReader(input);
TextPresentation textPresentation= new TextPresentation();
- HTML2TextReader htmlReader= new HTML2TextReader(reader, textPresentation);
- String result= htmlReader.getString();
+ String result;
+ try (HTML2TextReader htmlReader= new HTML2TextReader(reader, textPresentation)) {
+ result= htmlReader.getString();
+ }
if (DEBUG)
System.out.println("<" + result + "/>");
assertEquals(expectedOutput, result);
@@ -86,8 +88,10 @@ public class HTML2TextReaderTest extends TestCase {
private void verify(String input, String expectedOutput, StyleRange[] styleRanges) throws IOException {
Reader reader= new StringReader(input);
TextPresentation textPresentation= new TextPresentation();
- HTML2TextReader htmlReader= new HTML2TextReader(reader, textPresentation);
- String result= htmlReader.getString();
+ String result;
+ try (HTML2TextReader htmlReader= new HTML2TextReader(reader, textPresentation)) {
+ result= htmlReader.getString();
+ }
if (DEBUG)
System.out.println("<" + result + "/>");
assertEquals(expectedOutput, result);
@@ -174,7 +178,9 @@ public class HTML2TextReaderTest extends TestCase {
char[] cb= new char[20];
StringReader reader= new StringReader("<head>");
- new HTML2TextReader(reader, null).read(cb);
+ try (HTML2TextReader r= new HTML2TextReader(reader, null)) {
+ r.read(cb);
+ }
assertTrue(Arrays.equals(new char[20], cb));
}

Back to the top