changeset 7165:222da3d4692a

8014783: java/net/HttpURLPermission/HttpURLPermissionTest.java leaves files open Reviewed-by: michaelm
author chegar
date Fri, 17 May 2013 16:44:15 +0100
parents 3981ad7ec458
children fed779a87670
files test/java/net/HttpURLPermission/HttpURLPermissionTest.java
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/net/HttpURLPermission/HttpURLPermissionTest.java	Fri May 17 15:00:53 2013 +0100
+++ b/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");