RFR(S):8251374:jmap -dump should not accept invalid options

Hohensee, Paul hohensee at amazon.com
Wed Aug 12 14:32:15 UTC 2020


Looks good, but for readability, please add a space before the trailing single quote string, vis

System.err.println("Fail: invalid option: '" + subopt +"'");

should be

System.err.println("Fail: invalid option: '" + subopt + "'");

No need for a new webrev.

Thanks,
Paul

On 8/10/20, 8:00 PM, "serviceability-dev on behalf of linzang(臧琳)" <serviceability-dev-retn at openjdk.java.net on behalf of linzang at tencent.com> wrote:

    Here is the webrev: http://cr.openjdk.java.net/~lzang/8251374/webrev01/

    BRs,
    Lin

    On 2020/8/11, 10:52 AM, "linzang(臧琳)" <linzang at tencent.com> wrote:

        Hi All,
             May I ask your help to review this tiny patch? It fix an issue that jmap -dump could wrongly accept invalid optioins.
             Bugs: https://bugs.openjdk.java.net/browse/JDK-8251374
             Patch:  (Can not connect to webrev ftp currently, will try it later, following are all code changes)

        ################################
        --- old/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java 2020-08-11 10:42:32.044567791 +0800
        +++ new/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java 2020-08-11 10:42:31.876568681 +0800
        @@ -207,6 +207,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 +"'");
        +               System.exit(1);
                     }
                 }
        ################################

        Thanks,
        Lin





More information about the serviceability-dev mailing list