changeset 13189:f7c7fe9e2268

Merge
author asaha
date Wed, 07 Feb 2018 13:59:30 -0800
parents 9d10137b769f 46451609c8fc
children f7ef3bd0680e
files .hgtags src/share/classes/sun/security/tools/keytool/Main.java
diffstat 3 files changed, 41 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Feb 07 13:43:33 2018 -0800
+++ b/.hgtags	Wed Feb 07 13:59:30 2018 -0800
@@ -858,6 +858,8 @@
 ddae5cb11d6c04130b8002b852bc7f80e0c8bcd2 jdk8u162-b12
 8e40acfcc41a631f5922824712d4336742652eac jdk8u162-b31
 c00bdbbd9a77150f565298af9c305d7e6863eb59 jdk8u162-b32
+70a653814e61a5552312345308b85330fa8f27bc jdk8u162-b33
+f1f949ac13549c6fb3766279848539b124ad835e jdk8u162-b34
 b6195815c4bbbf275f1aefd337d805eb66f2b5b8 jdk8u171-b00
 f1792a59f1fa20e47fe5d4561754012440564bec jdk8u171-b01
 cac020298633fc736f5e21afddf00145665ef0a7 jdk8u171-b02
--- a/src/share/bin/java.c	Wed Feb 07 13:43:33 2018 -0800
+++ b/src/share/bin/java.c	Wed Feb 07 13:59:30 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2018, 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
@@ -660,15 +660,24 @@
          * arguments are for the application (i.e. the main class name, or
          * the -jar argument).
          */
-        if ((i > 0 && *arg != '-')
-                || JLI_StrCmp(arg, "-version") == 0
-                || JLI_StrCmp(arg, "-fullversion") == 0
-                || JLI_StrCmp(arg, "-help") == 0
-                || JLI_StrCmp(arg, "-?") == 0
-                || JLI_StrCmp(arg, "-jar") == 0
-                || JLI_StrCmp(arg, "-X") == 0
-                ) {
-            return;
+        if (i > 0) {
+            char *prev = argv[i - 1];
+            // skip non-dash arg preceded by class path specifiers
+            if (*arg != '-' &&
+                    ((JLI_StrCmp(prev, "-cp") == 0
+                    || JLI_StrCmp(prev, "-classpath") == 0))) {
+                continue;
+            }
+
+            if (*arg != '-'
+                    || JLI_StrCmp(arg, "-version") == 0
+                    || JLI_StrCmp(arg, "-fullversion") == 0
+                    || JLI_StrCmp(arg, "-help") == 0
+                    || JLI_StrCmp(arg, "-?") == 0
+                    || JLI_StrCmp(arg, "-jar") == 0
+                    || JLI_StrCmp(arg, "-X") == 0) {
+                return;
+            }
         }
         /*
          * The following case checks for "-XX:NativeMemoryTracking=value".
--- a/test/tools/launcher/TestSpecialArgs.java	Wed Feb 07 13:43:33 2018 -0800
+++ b/test/tools/launcher/TestSpecialArgs.java	Wed Feb 07 13:59:30 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7124089 7131021 8042469 8066185
+ * @bug 7124089 7131021 8042469 8066185 8074373
  * @summary Checks for Launcher special flags, such as MacOSX specific flags,
  *          and JVM NativeMemoryTracking flags.
  * @compile -XDignore.symbol.file TestSpecialArgs.java EnvironmentVariables.java
@@ -270,6 +270,16 @@
         tr = doExec(envMap, javaCmd, "Foo", "-XX:NativeMemoryTracking=summary");
         checkTestResult(tr);
 
+        // should accept with no warnings
+        tr = doExec(javaCmd, "-cp", jarFile.getName(),
+                    "-XX:NativeMemoryTracking=summary", "Foo");
+        ensureNoWarnings(tr);
+
+        // should accept with no warnings
+        tr = doExec(javaCmd, "-classpath", jarFile.getName(),
+                    "-XX:NativeMemoryTracking=summary", "Foo");
+        ensureNoWarnings(tr);
+
         // make sure a missing class is handled correctly, because the class
         // resolution is performed by the JVM.
         tr = doExec(javaCmd, "AbsentClass", "-XX:NativeMemoryTracking=summary");
@@ -278,6 +288,14 @@
         }
     }
 
+    void ensureNoWarnings(TestResult tr) {
+        checkTestResult(tr);
+        if (tr.contains("warning: Native Memory Tracking")) {
+            System.err.println(tr.toString());
+            throw new RuntimeException("Test Fails");
+        }
+    }
+
     void checkTestResult(TestResult tr) {
         if (!tr.isOK()) {
             System.err.println(tr.toString());