提交 f4cfc12c 编写于 作者: C chegar

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

Reviewed-by: michaelm
上级 dfc91b6a
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册