changeset 60555:95e8aba3b047

8251374: jmap -dump could accept invalid options Summary: Emit usage(1) in dump() argument loop Reviewed-by: sspitsyn, phh
author lzang
date Thu, 13 Aug 2020 13:57:12 -0700
parents 963230d5d225
children 7dfca7d32df8
files src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java	Thu Aug 13 15:42:21 2020 -0400
+++ b/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java	Thu Aug 13 13:57:12 2020 -0700
@@ -216,6 +216,11 @@
                 liveopt = "-live";
             } else if (subopt.startsWith("file=")) {
                 filename = parseFileName(subopt);
+            } else if (subopt.equals("format=b")) {
+                // ignore format (not needed at this time)
+            } else {
+                System.err.println("Fail: invalid option: '" + subopt + "'");
+                usage(1);
             }
         }