changeset 14422:7aa6fef2b351

8156801: java/net/httpclient/security/Driver.java failed with RuntimeException: Non zero return value Reviewed-by: chegar
author michaelm
date Thu, 12 May 2016 16:06:17 +0100
parents 698b526d7c3b
children fe3e1508653e
files test/java/net/httpclient/security/Security.java
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/net/httpclient/security/Security.java	Thu May 12 13:06:03 2016 +0800
+++ b/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);