8156801: java/net/httpclient/security/Driver.java failed with RuntimeException: Non zero return value
authormichaelm
Thu, 12 May 2016 16:06:17 +0100
changeset 37897 bc8dc7bc4a03
parent 37896 cd841af7dcd0
child 37898 ac36c71a44f9
8156801: java/net/httpclient/security/Driver.java failed with RuntimeException: Non zero return value Reviewed-by: chegar
jdk/test/java/net/httpclient/security/Security.java
--- a/jdk/test/java/net/httpclient/security/Security.java	Thu May 12 13:06:03 2016 +0800
+++ b/jdk/test/java/net/httpclient/security/Security.java	Thu May 12 16:06:17 2016 +0100
@@ -68,6 +68,8 @@
 import java.util.logging.ConsoleHandler;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import java.lang.reflect.InvocationTargetException;
+import java.net.BindException;
 
 /**
  * Security checks test
@@ -142,8 +144,12 @@
         }
     }
 
-    static Object getProxy(int port, boolean b) throws Exception {
-        return proxyConstructor.newInstance(port, b);
+    static Object getProxy(int port, boolean b) throws Throwable {
+        try {
+            return proxyConstructor.newInstance(port, b);
+        } catch (InvocationTargetException e) {
+            throw e.getTargetException();
+        }
     }
 
     static Class<?> proxyClass;
@@ -319,10 +325,10 @@
         Object proxy = null;
         try {
             proxy = getProxy(proxyPort, true);
-        } catch (IOException e) {
-            System.out.println("Cannot bind. Not running test");
-            throw new SecurityException("test not run");
-        } catch (Exception ee) {
+        } catch (BindException e) {
+            System.out.println("Bind failed");
+            throw e;
+        } catch (Throwable ee) {
             throw new RuntimeException(ee);
         }
         System.out.println("Proxy port = " + proxyPort);