From d6531cbf9faf9d27242cd8d319e27ccde86ed7a7 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Fri, 17 May 2013 16:44:15 +0100 Subject: [PATCH] 8014783: java/net/HttpURLPermission/HttpURLPermissionTest.java leaves files open Reviewed-by: michaelm --- .../net/HttpURLPermission/HttpURLPermissionTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jdk/test/java/net/HttpURLPermission/HttpURLPermissionTest.java b/jdk/test/java/net/HttpURLPermission/HttpURLPermissionTest.java index c2debe7a0bd..4f4ea85d495 100644 --- a/jdk/test/java/net/HttpURLPermission/HttpURLPermissionTest.java +++ b/jdk/test/java/net/HttpURLPermission/HttpURLPermissionTest.java @@ -187,11 +187,12 @@ public class HttpURLPermissionTest { 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");