8067421: java -help contains information about "-version:",'-jre-restrict-search', '-no-jre-restrict-search', but they are removed
authorksrini
Tue, 16 Dec 2014 16:02:56 -0800
changeset 28109 c510e26fcd55
parent 28108 ded6ce6679a4
child 28113 ef63e17cd3ce
8067421: java -help contains information about "-version:",'-jre-restrict-search', '-no-jre-restrict-search', but they are removed 8067411: tools/launcher/MultipleJRE.sh requires adjustments to work with module boundaries 8067290: Missing bug id in test/tools/launcher/* Reviewed-by: darcy
jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties
jdk/test/tools/launcher/MultipleJRE.sh
jdk/test/tools/launcher/PrintVersion.java
jdk/test/tools/launcher/UglyPrintVersion.java
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Tue Dec 16 13:45:20 2014 -0800
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Tue Dec 16 16:02:56 2014 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -46,11 +46,7 @@
 \    -verbose:[class|gc|jni]\n\
 \                  enable verbose output\n\
 \    -version      print product version and exit\n\
-\    -version:<value>\n\
-\                  require the specified version to run\n\
 \    -showversion  print product version and continue\n\
-\    -jre-restrict-search | -no-jre-restrict-search\n\
-\                  include/exclude user private JREs in the version search\n\
 \    -? -help      print this help message\n\
 \    -X            print help on non-standard options\n\
 \    -ea[:<packagename>...|:<classname>]\n\
--- a/jdk/test/tools/launcher/MultipleJRE.sh	Tue Dec 16 13:45:20 2014 -0800
+++ b/jdk/test/tools/launcher/MultipleJRE.sh	Tue Dec 16 16:02:56 2014 -0800
@@ -1,15 +1,14 @@
 #!/bin/sh
 # @test MultipleJRE.sh
-# @bug 4811102 4953711 4955505 4956301 4991229 4998210 5018605 6387069 6733959
+# @bug 4811102 4953711 4955505 4956301 4991229 4998210 5018605 6387069 6733959 8058407 8067421
 # @build PrintVersion
 # @build UglyPrintVersion
 # @build ZipMeUp
 # @run shell MultipleJRE.sh
 # @summary Verify Multiple JRE version support has been removed
 # @author Joseph E. Kowalski
-
 #
-# Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -91,6 +90,36 @@
 }
 
 #
+# Shell routine to ensure help page does not include mjre options
+#
+TestHelp() {
+    mess="`$JAVA -help 2>&1`"
+    # make sure it worked
+    if [ $? -ne 0 ]; then
+        echo "java -help failed ????"
+        exit 1
+    fi
+
+    echo $mess | grep '\-version:<value>' > /dev/null 2>&1
+    if [ $? -eq 0 ]; then
+       echo "help message contains obsolete option version:<value>"
+       exit 1
+    fi
+
+    echo $mess | grep '\-jre-restrict-search' > /dev/null 2>&1
+    if [ $? -eq 0 ]; then
+       echo "help message contains obsolete option jre-restrict-search"
+       exit 1
+    fi
+
+    echo $mess | grep '\-no-jre-restrict-search' > /dev/null 2>&1
+    if [ $? -eq 0 ]; then
+       echo "help message contains obsolete option no-jre-restrict-search"
+       exit 1
+    fi
+}
+
+#
 # Just as the name says.  We sprinkle these in the appropriate location
 # in the test file system and they just say who they are pretending to be.
 #
@@ -457,7 +486,8 @@
 	LaunchVM "" "${RELEASE}"
         # Going to silently ignore JRE-Version setting in jar file manifest
 	#LaunchVM "" "warning: The jarfile JRE-Version"
-	
+
+	# Verify help does not contain obsolete options
+	TestHelp
 
 exit 0
-
--- a/jdk/test/tools/launcher/PrintVersion.java	Tue Dec 16 13:45:20 2014 -0800
+++ b/jdk/test/tools/launcher/PrintVersion.java	Tue Dec 16 16:02:56 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,12 +27,9 @@
  * This stub simply prints out the java version string. It is used
  * by MultipleJRE.sh.
  */
-import sun.misc.Version;
 
 public class PrintVersion {
-
-        public static void main(String argv[]) {
-                Version.print();
-        }
-
+    public static void main(String argv[]) {
+        System.out.println(System.getProperty("java.version"));
+    }
 }
--- a/jdk/test/tools/launcher/UglyPrintVersion.java	Tue Dec 16 13:45:20 2014 -0800
+++ b/jdk/test/tools/launcher/UglyPrintVersion.java	Tue Dec 16 16:02:56 2014 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,12 +30,8 @@
  */
 package reallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallyreallylongpackagename;
 
-import sun.misc.Version;
-
 public class UglyPrintVersion {
-
-        public static void main(String argv[]) {
-                Version.print();
-        }
-
+    public static void main(String argv[]) {
+        System.out.println(System.getProperty("java.version"));
+    }
 }