First make sure your change doesn't break existing jtreg tests, the ones in jdk/test/sun/tools/jstat.

If everything is fine, you could add output verification to jstatHelp.sh, similar to what exists today for -? and -help.

Thanks
Erik

Yuri Gaevsky skrev 2014-11-27 18:10:
Hi Erik,

The change just makes jstat's behaviour more consistent with jinfo/jstack/jmap.
Please also notice that there is a bug [1] about jhat tool removal (in Java SE 
9?).

I'm not a reviewer, but I can sponsor your patch if it is accepted. If
so, could you update the test as well.
It would be great, thank you so much. What test in 'jdk/test/sun/tools/jstat/' 
should be
updated for that?

Best regards,
-Yuri

[1] https://bugs.openjdk.java.net/browse/JDK-8044830

-----Original Message-----
From: serviceability-dev [mailto:serviceability-dev-boun...@openjdk.java.net] 
On Behalf Of Erik Gahlin
Sent: Thursday, November 27, 2014 6:29 PM
To: serviceability-dev@openjdk.java.net
Subject: Re: RFR(XS) 6364329 jstat displays "invalid argument count" with usage

Hi Yuri,

Not sure what the correct behavior is. This is what I get:

jinfo - prints help
jhat  - prints "ERROR: No arguments supplied" + help
jstack -prints help
jstatd -prints "Could not create remote object" and a security exception
jstat - prints "invalid argument count" + help
jmap - prints help

I'm not a reviewer, but I can sponsor your patch if it is accepted. If
so, could you update the test as well.

Thanks
Erik


Yuri Gaevsky skrev 2014-11-26 16:08:
ping...

-----Original Message-----
From: serviceability-dev [mailto:serviceability-dev-boun...@openjdk.java.net] 
On Behalf Of Yuri Gaevsky
Sent: Thursday, November 20, 2014 1:11 AM
To: serviceability-dev@openjdk.java.net
Subject: RFR(XS) 6364329 jstat displays "invalid argument count" with usage

Hello.

Please see below a small fix for integration into JDK 9:

$ hg diff
diff --git a/src/jdk.jcmd/share/classes/sun/tools/jstat/Arguments.java 
b/src/jdk.jcmd/share/classes/sun/tools/jstat/Arguments.java
--- a/src/jdk.jcmd/share/classes/sun/tools/jstat/Arguments.java
+++ b/src/jdk.jcmd/share/classes/sun/tools/jstat/Arguments.java
@@ -141,8 +141,9 @@
       public Arguments(String[] args) throws IllegalArgumentException {
           int argc = 0;
- if (args.length < 1) {
-            throw new IllegalArgumentException("invalid argument count");
+        if (args.length == 0) {
+            help = true;
+            return;
           }
if ((args[0].compareTo("-?") == 0)


Thanks,
-Yuri



Reply via email to