8014783: java/net/HttpURLPermission/HttpURLPermissionTest.java leaves files open
Reviewed-by: michaelm
--- a/jdk/test/java/net/HttpURLPermission/HttpURLPermissionTest.java Fri May 17 15:00:53 2013 +0100
+++ b/jdk/test/java/net/HttpURLPermission/HttpURLPermissionTest.java Fri May 17 16:44:15 2013 +0100
@@ -187,11 +187,12 @@
throws Exception {
HttpURLPermission out = new HttpURLPermission(name, actions);
- FileOutputStream fos = new FileOutputStream("out.ser");
- ObjectOutputStream o = new ObjectOutputStream(fos);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream o = new ObjectOutputStream(baos);
o.writeObject(out);
- FileInputStream fis = new FileInputStream("out.ser");
- ObjectInputStream i = new ObjectInputStream(fis);
+ ByteArrayInputStream bain = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream i = new ObjectInputStream(bain);
HttpURLPermission in = (HttpURLPermission)i.readObject();
if (!in.equals(out)) {
System.out.println ("FAIL");