On 17 November 2013 21:51, <[email protected]> wrote:
> Author: pmouawad
> Date: Sun Nov 17 21:51:41 2013
> New Revision: 1542839
>
> URL: http://svn.apache.org/r1542839
> Log:
> Test correctly keytool command success
>
> Modified:
> jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java
>
> Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java?rev=1542839&r1=1542838&r2=1542839&view=diff
> ==============================================================================
> --- jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java
> (original)
> +++ jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java Sun
> Nov 17 21:51:41 2013
> @@ -393,8 +393,8 @@ public class KeyToolUtils {
> arguments.add(keytoolPath);
> arguments.add("-help"); // $NON-NLS-1$
> try {
> - nativeCommand.run(arguments);
> - return true;
> + int status = nativeCommand.run(arguments);
> + return status == 0;
Unfortunately "keytool -help" exits with status 1 on Java 1.6.
I have tested both Windows XP and FreeBSD (people.a.o)
If the application does not exist, it should generate an IOException -
i.e. we don't need to rely on the status.
Or perhaps we could test for status == 1 as well, but I think it would
be safer to ignore the status (as the code did originally)
Status returns of 0,1,2 etc are common for Unix applications, but I
suspect that it was a bug for -help to cause status 1.
> } catch (IOException ioe) {
> return false;
> } catch (InterruptedException e) {
>
>