Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Mazursky2013-08-27 23:58:56 -0400
committerGerrit Code Review @ Eclipse.org2013-09-09 00:24:31 -0400
commit767faece5c4692748d1ac8e130b2e4c5faa1ff20 (patch)
tree787e93c5bf452b69d28d737a04d57cddae0b7ede /jetty-security/src/test/java/org/eclipse/jetty
parentcdd95bb5515f35af090bcbcf6f9af03d5c6762c9 (diff)
downloadorg.eclipse.jetty.project-767faece5c4692748d1ac8e130b2e4c5faa1ff20.tar.gz
org.eclipse.jetty.project-767faece5c4692748d1ac8e130b2e4c5faa1ff20.tar.xz
org.eclipse.jetty.project-767faece5c4692748d1ac8e130b2e4c5faa1ff20.zip
[Bug 415999] Fix some of FindBugs warnings
Mostly not closed streams/DB resources are fixed. But also less important things. Signed-off-by: Mikhail Mazursky <mikhail.mazursky@gmail.com>
Diffstat (limited to 'jetty-security/src/test/java/org/eclipse/jetty')
-rw-r--r--jetty-security/src/test/java/org/eclipse/jetty/security/PropertyUserStoreTest.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/jetty-security/src/test/java/org/eclipse/jetty/security/PropertyUserStoreTest.java b/jetty-security/src/test/java/org/eclipse/jetty/security/PropertyUserStoreTest.java
index a25ee6384e..6b68b9b36b 100644
--- a/jetty-security/src/test/java/org/eclipse/jetty/security/PropertyUserStoreTest.java
+++ b/jetty-security/src/test/java/org/eclipse/jetty/security/PropertyUserStoreTest.java
@@ -21,6 +21,7 @@ package org.eclipse.jetty.security;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
+import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@@ -55,19 +56,21 @@ public class PropertyUserStoreTest
private void writeInitialUsers(String testFile) throws Exception
{
- BufferedWriter writer = new BufferedWriter(new FileWriter(testFile));
- writer.append("tom: tom, roleA\n");
- writer.append("dick: dick, roleB\n");
- writer.append("harry: harry, roleA, roleB\n");
- writer.close();
+ try (Writer writer = new BufferedWriter(new FileWriter(testFile)))
+ {
+ writer.append("tom: tom, roleA\n");
+ writer.append("dick: dick, roleB\n");
+ writer.append("harry: harry, roleA, roleB\n");
+ }
}
private void writeAdditionalUser(String testFile) throws Exception
{
Thread.sleep(1001);
- BufferedWriter writer = new BufferedWriter(new FileWriter(testFile,true));
- writer.append("skip: skip, roleA\n");
- writer.close();
+ try (Writer writer = new BufferedWriter(new FileWriter(testFile,true)))
+ {
+ writer.append("skip: skip, roleA\n");
+ }
}
@Test

Back to the top