RFR [9] 8078568 java/net/URLPermission/URLTest.java fails intermittently with BindException

Daniel Fuchs daniel.fuchs at oracle.com
Thu Jul 21 13:37:27 UTC 2016


Hi,

Looks good to me Chris.

The only thing I noticed is this:

-            if (! (e instanceof SecurityException) &&
-                        !(e.getCause() instanceof SecurityException)  ||
-                        !exceptionExpected)
-            {
-                System.out.println ("FAIL");
-                //e.printStackTrace();
+            if (!expectException || !(e.getCause() instanceof 
SecurityException)) {
+                System.out.println ("FAIL. Unexpected: " + e.getMessage());
+                e.printStackTrace();


The new version does not check that e is an instance
of SecurityExcption. I'm also a bit surprised to see that
the test expects the SecurityException to be wrapped.

cheers,

-- daniel

On 20/07/16 15:41, Chris Hegarty wrote:
> The test uses hardcoded port numbers for its listening HTTP and HTTPS severs.
> These hardcoded port numbers are problematic as the ports may not necessarily
> be available. The reason for the hardcoded port numbers is that the test uses a
> number of static, checked in, policy files, to grant ( and restrict ) permission
> required for various explicit test scenarios.
>
> A better solution, which avoids the need for hardcoded port numbers, is for the
> test to configure the security policy dynamically. This also has the advantage of
> improving the readability of the test, since the code that grants the permissions
> is along side the test code that makes assertions based on these permissions.
>
> The individual test scenarios have not changed.
>
> http://cr.openjdk.java.net/~chegar/8078568/
> https://bugs.openjdk.java.net/browse/JDK-8078568
>
> -Chris.
>



More information about the net-dev mailing list