8014783: java/net/HttpURLPermission/HttpURLPermissionTest.java leaves files open

Reviewed-by: michaelm
This commit is contained in:
Chris Hegarty 2013-05-17 16:44:15 +01:00
parent c17637a0f8
commit d6531cbf9f

View File

@ -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");