Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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