< prev index next >

test/jdk/tools/launcher/VersionCheck.java

Print this page


   1 /*
   2  * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  48         "controlpanel",
  49         "jabswitch",
  50         "java-rmi",
  51         "java-rmi.cgi",
  52         "java",
  53         "javacpl",
  54         "jaccessinspector",
  55         "jaccessinspector-32",
  56         "jaccesswalker",
  57         "jaccesswalker-32",
  58         "jaotc",
  59         "javaw",
  60         "javaws",
  61         "jcontrol",
  62         "jmc",
  63         "jmc.ini",
  64         "jweblauncher",
  65         "packager",
  66         "ssvagent",
  67         "unpack200",
  68         "wsimport"
  69     };
  70 
  71     // tools that do not accept -version
  72     static final String[] BLACKLIST_VERSION = {
  73         "appletviewer",
  74         "controlpanel",
  75         "jaccessinspector",
  76         "jaccessinspector-32",
  77         "jaccesswalker",
  78         "jaccesswalker-32",
  79         "jaotc",
  80         "jar",
  81         "jarsigner",
  82         "java-rmi",
  83         "java-rmi.cgi",
  84         "javadoc",
  85         "javacpl",
  86         "javaws",
  87         "jcmd",
  88         "jconsole",


  90         "jdeprscan",
  91         "jdeps",
  92         "jimage",
  93         "jinfo",
  94         "jlink",
  95         "jmap",
  96         "jmod",
  97         "jmc",
  98         "jmc.ini",
  99         "jps",
 100         "jrunscript",
 101         "jjs",
 102         "jstack",
 103         "jstat",
 104         "jstatd",
 105         "jweblauncher",
 106         "keytool",
 107         "kinit",
 108         "klist",
 109         "ktab",
 110         "orbd",
 111         "pack200",
 112         "packager",
 113         "rmic",
 114         "rmid",
 115         "rmiregistry",
 116         "schemagen", // returns error code 127
 117         "serialver",
 118         "servertool",
 119         "ssvagent",
 120         "tnameserv",
 121         "unpack200",
 122         "wsgen",
 123         "wsimport",
 124         "xjc"
 125     };
 126 
 127     // expected reference strings
 128     static String refVersion;
 129     static String refFullVersion;
 130 
 131     static String getAllVersionLines(String... argv) {
 132         return getVersion0(true, argv);
 133     }
 134 
 135     static String getVersion(String... argv) {
 136         return getVersion0(false, argv);
 137     }
 138 
 139     static String getVersion0(boolean allLines, String... argv) {
 140         TestHelper.TestResult tr = doExec(argv);
 141         StringBuilder out = new StringBuilder();
 142         // remove the HotSpot line
 143         for (String x : tr.testOutput) {
 144             if (allLines || !x.matches(".*Client.*VM.*|.*Server.*VM.*")) {


   1 /*
   2  * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  48         "controlpanel",
  49         "jabswitch",
  50         "java-rmi",
  51         "java-rmi.cgi",
  52         "java",
  53         "javacpl",
  54         "jaccessinspector",
  55         "jaccessinspector-32",
  56         "jaccesswalker",
  57         "jaccesswalker-32",
  58         "jaotc",
  59         "javaw",
  60         "javaws",
  61         "jcontrol",
  62         "jmc",
  63         "jmc.ini",
  64         "jweblauncher",
  65         "packager",
  66         "ssvagent",
  67         "unpack200",

  68     };
  69 
  70     // tools that do not accept -version
  71     static final String[] BLACKLIST_VERSION = {
  72         "appletviewer",
  73         "controlpanel",
  74         "jaccessinspector",
  75         "jaccessinspector-32",
  76         "jaccesswalker",
  77         "jaccesswalker-32",
  78         "jaotc",
  79         "jar",
  80         "jarsigner",
  81         "java-rmi",
  82         "java-rmi.cgi",
  83         "javadoc",
  84         "javacpl",
  85         "javaws",
  86         "jcmd",
  87         "jconsole",


  89         "jdeprscan",
  90         "jdeps",
  91         "jimage",
  92         "jinfo",
  93         "jlink",
  94         "jmap",
  95         "jmod",
  96         "jmc",
  97         "jmc.ini",
  98         "jps",
  99         "jrunscript",
 100         "jjs",
 101         "jstack",
 102         "jstat",
 103         "jstatd",
 104         "jweblauncher",
 105         "keytool",
 106         "kinit",
 107         "klist",
 108         "ktab",

 109         "pack200",
 110         "packager",
 111         "rmic",
 112         "rmid",
 113         "rmiregistry",

 114         "serialver",
 115         "servertool",
 116         "ssvagent",
 117         "unpack200"




 118     };
 119 
 120     // expected reference strings
 121     static String refVersion;
 122     static String refFullVersion;
 123 
 124     static String getAllVersionLines(String... argv) {
 125         return getVersion0(true, argv);
 126     }
 127 
 128     static String getVersion(String... argv) {
 129         return getVersion0(false, argv);
 130     }
 131 
 132     static String getVersion0(boolean allLines, String... argv) {
 133         TestHelper.TestResult tr = doExec(argv);
 134         StringBuilder out = new StringBuilder();
 135         // remove the HotSpot line
 136         for (String x : tr.testOutput) {
 137             if (allLines || !x.matches(".*Client.*VM.*|.*Server.*VM.*")) {


< prev index next >