Thanks for the clarifications, Erik.

Please see below the updated patch for JDK-6364329:

--- start ---
$ 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)
diff --git a/test/sun/tools/jstat/jstatHelp.sh 
b/test/sun/tools/jstat/jstatHelp.sh
--- a/test/sun/tools/jstat/jstatHelp.sh
+++ b/test/sun/tools/jstat/jstatHelp.sh
@@ -22,9 +22,9 @@
 #
 
 # @test
-# @bug 4990825
+# @bug 4990825 6364329
 # @run shell jstatHelp.sh
-# @summary Test that output of 'jstat -?' matches the usage.out file
+# @summary Test that output of 'jstat -?', 'jstat -help' and 'jstat' matches 
the usage.out file
 
 . ${TESTSRC-.}/../../jvmstat/testlibrary/utils.sh
 
@@ -38,7 +38,7 @@
 diff -w jstat.out ${TESTSRC}/usage.out
 if [ $? != 0 ]
 then
-  echo "Output of jstat -? differ from expected output. Failed."
+  echo "Output of jstat -? differs from expected output. Failed."
   exit 1
 fi
 
@@ -48,7 +48,17 @@
 diff -w jstat.out ${TESTSRC}/usage.out
 if [ $? != 0 ]
 then
-  echo "Output of jstat -help differ from expected output. Failed."
+  echo "Output of jstat -help differs from expected output. Failed."
+  exit 1
+fi
+
+rm -f jstat.out 2>/dev/null
+${JSTAT} -J-XX:+UsePerfData > jstat.out 2>&1
+
+diff -w jstat.out ${TESTSRC}/usage.out
+if [ $? != 0 ]
+then
+  echo "Output of jstat differs from expected output. Failed."
   exit 1
 fi
--- end ---

Best regards,
-Yuri

-----Original Message-----
From: Erik Gahlin [mailto:erik.gah...@oracle.com] 
Sent: Friday, November 28, 2014 12:00 AM
To: Yuri Gaevsky
Cc: serviceability-dev@openjdk.java.net
Subject: Re: RFR(XS) 6364329 jstat displays "invalid argument count" with usage

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

Reply via email to