--- a/test/jdk/java/net/Socket/ExceptionText.java Tue Jul 24 12:12:16 2018 -0700
+++ b/test/jdk/java/net/Socket/ExceptionText.java Wed Jul 25 10:08:39 2018 +0100
@@ -25,18 +25,43 @@
* @test
* @library /test/lib
* @build jdk.test.lib.Utils
- * @bug 8204233
+ * @bug 8204233 8207846
* @summary Add configurable option for enhanced socket IOException messages
- * @run main/othervm ExceptionText
- * @run main/othervm -Djdk.net.includeInExceptions= ExceptionText
- * @run main/othervm -Djdk.net.includeInExceptions=hostInfo ExceptionText
- * @run main/othervm -Djdk.net.includeInExceptions=somethingElse ExceptionText
+ * @run main/othervm
+ * ExceptionText
+ * WITHOUT_Enhanced_Text
+ * @run main/othervm
+ * -Djdk.includeInExceptions=
+ * ExceptionText
+ * WITHOUT_Enhanced_Text
+ * @run main/othervm
+ * -Djdk.includeInExceptions=somethingElse
+ * ExceptionText
+ * WITHOUT_Enhanced_Text
+ * @run main/othervm
+ * -Djdk.includeInExceptions=blah,blah,blah,
+ * ExceptionText
+ * WITHOUT_Enhanced_Text
+ * @run main/othervm
+ * -Djdk.includeInExceptions=hostInfo
+ * ExceptionText
+ * expectEnhancedText
+ * @run main/othervm
+ * -Djdk.includeInExceptions=foo,hostinfo,bar
+ * ExceptionText
+ * expectEnhancedText
+ * @run main/othervm
+ * -Djdk.includeInExceptions=",HOSTINFO,"
+ * ExceptionText
+ * expectEnhancedText
*/
-import java.net.*;
import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.nio.channels.AsynchronousSocketChannel;
import java.nio.channels.ClosedChannelException;
-import java.nio.channels.*;
+import java.nio.channels.SocketChannel;
import java.util.concurrent.ExecutionException;
import jdk.test.lib.Utils;
@@ -44,16 +69,15 @@
enum TestTarget {SOCKET, CHANNEL, ASYNC_CHANNEL};
- static boolean propEnabled() {
- String val = System.getProperty("jdk.net.includeInExceptions");
- if ("hostinfo".equalsIgnoreCase(val))
- return true;
- return false;
- }
-
public static void main(String args[]) throws Exception {
- boolean prop = propEnabled();
- test(prop);
+ String passOrFail = args[0];
+ boolean expectEnhancedText;
+ if (passOrFail.equals("expectEnhancedText")) {
+ expectEnhancedText = true;
+ } else {
+ expectEnhancedText = false;
+ }
+ test(expectEnhancedText);
}
static final InetSocketAddress dest = Utils.refusingEndpoint();