RFR 8014791: More ProblemList.txt updates (5/2013)

Chris Hegarty chris.hegarty at oracle.com
Fri May 17 07:40:44 PDT 2013


On 17/05/2013 12:22, Alan Bateman wrote:
> ....
> For java/net/HttpURLPermission/HttpURLPermissionTest.java then I assume
> that using try-with-resources around the code that opens the .ser files
> will sort this out (meaning might be as quick to just fix this one).

For this, I propose to simply replace the use of the file as a holder 
for the serial byte, with ByteArrayOutputStream.

hg diff HttpURLPermissionTest.java
diff -r fab0e4b682e8 
test/java/net/HttpURLPermission/HttpURLPermissionTest.java
--- a/test/java/net/HttpURLPermission/HttpURLPermissionTest.java 
Fri May 17 15:18:40 2013 +0100
+++ b/test/java/net/HttpURLPermission/HttpURLPermissionTest.java 
Fri May 17 15:34:54 2013 +0100
@@ -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");


-Chris.



More information about the net-dev mailing list