jdk/test/java/net/httpclient/security/Security.java
changeset 37897 bc8dc7bc4a03
parent 37791 ae33107fd8b3
child 38883 d5de564f8089
--- 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);