You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by sebb <se...@gmail.com> on 2013/11/23 18:59:41 UTC

Re: svn commit: r1542839 - /jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java

On 17 November 2013 21:51,  <pm...@apache.org> 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) {
>
>

Re: svn commit: r1542839 - /jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java

Posted by sebb <se...@gmail.com>.
On 23 November 2013 23:19, sebb <se...@gmail.com> wrote:
> On 23 November 2013 23:02, Philippe Mouawad <ph...@gmail.com> wrote:
>> On Sat, Nov 23, 2013 at 11:24 PM, sebb <se...@gmail.com> wrote:
>>
>>> On 23 November 2013 21:31, Philippe Mouawad <ph...@gmail.com>
>>> wrote:
>>> > Hello sebb,
>>> >
>>> > I made the following test
>>> > I have a jdk7 in:
>>> > - /data/jdks/jdk7u25/
>>> >
>>> > I moved keytool to keytool.old.
>>> >
>>> > KeyToolUtils#checkKeytool returns true while it should return false no ?
>>>
>>> Yes, it should return false.
>>>
>>> > No exception is thrown and while stdout contains:
>>> > Unable to locate an executable at
>>> > "/data/jdks/jdk7u25/Contents/Home//bin/keytool" (-1)
>>>
>>> So if you capture the status what is its value?
>>>
>> 2
>
> In that case, it would work if we check for status == 0,1.
>
> However, that is not a particularly safe check.
>
> Do all the Java versions behave that way on MacOS ?
> Seems to me it might be a bug in that version of Java.

Just noticed that the Windows IOE message says:

CreateProcess error=2, The system cannot find the file specified

It looks like Windows is converting the CreateProcess error to an IOException.

It looks more & more like the MacOS behaviour is a bug - how can the
caller distinguish between a valid application that exits with status
2 and a missing application? It does not seem right that complete
failure to start the process should be reported as a status error.

>>
>>> >
>>> >
>>> > On Sat, Nov 23, 2013 at 10:22 PM, sebb <se...@gmail.com> wrote:
>>> >
>>> >> On 23 November 2013 18:55, Philippe Mouawad <philippe.mouawad@gmail.com
>>> >
>>> >> wrote:
>>> >> > On Saturday, November 23, 2013, sebb wrote:
>>> >> >
>>> >> >> On 17 November 2013 21:51,  <pmouawad@apache.org <javascript:;>>
>>> 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.
>>> >> >>
>>> >> >> I added it because on macos it does not throw , so it didn't report
>>> any
>>> >> > error even if keytool was partly broken
>>> >>
>>> >> What do you mean by "partly broken" ?
>>> >>
>>> >> BTW, next time it would help if you documented the real reason in the
>>> >> log comment and the code when making a change.
>>> >>
>>> >> >>          } catch (IOException ioe) {
>>> >> >> >                 return false;
>>> >> >> >          } catch (InterruptedException e) {
>>> >> >> >
>>> >> >> >
>>> >> >>
>>> >> >
>>> >> >
>>> >> > --
>>> >> > Cordialement.
>>> >> > Philippe Mouawad.
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > Cordialement.
>>> > Philippe Mouawad.
>>>
>>
>>
>>
>> --
>> Cordialement.
>> Philippe Mouawad.

Re: svn commit: r1542839 - /jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java

Posted by sebb <se...@gmail.com>.
On 23 November 2013 23:02, Philippe Mouawad <ph...@gmail.com> wrote:
> On Sat, Nov 23, 2013 at 11:24 PM, sebb <se...@gmail.com> wrote:
>
>> On 23 November 2013 21:31, Philippe Mouawad <ph...@gmail.com>
>> wrote:
>> > Hello sebb,
>> >
>> > I made the following test
>> > I have a jdk7 in:
>> > - /data/jdks/jdk7u25/
>> >
>> > I moved keytool to keytool.old.
>> >
>> > KeyToolUtils#checkKeytool returns true while it should return false no ?
>>
>> Yes, it should return false.
>>
>> > No exception is thrown and while stdout contains:
>> > Unable to locate an executable at
>> > "/data/jdks/jdk7u25/Contents/Home//bin/keytool" (-1)
>>
>> So if you capture the status what is its value?
>>
> 2

In that case, it would work if we check for status == 0,1.

However, that is not a particularly safe check.

Do all the Java versions behave that way on MacOS ?
Seems to me it might be a bug in that version of Java.

>
>> >
>> >
>> > On Sat, Nov 23, 2013 at 10:22 PM, sebb <se...@gmail.com> wrote:
>> >
>> >> On 23 November 2013 18:55, Philippe Mouawad <philippe.mouawad@gmail.com
>> >
>> >> wrote:
>> >> > On Saturday, November 23, 2013, sebb wrote:
>> >> >
>> >> >> On 17 November 2013 21:51,  <pmouawad@apache.org <javascript:;>>
>> 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.
>> >> >>
>> >> >> I added it because on macos it does not throw , so it didn't report
>> any
>> >> > error even if keytool was partly broken
>> >>
>> >> What do you mean by "partly broken" ?
>> >>
>> >> BTW, next time it would help if you documented the real reason in the
>> >> log comment and the code when making a change.
>> >>
>> >> >>          } catch (IOException ioe) {
>> >> >> >                 return false;
>> >> >> >          } catch (InterruptedException e) {
>> >> >> >
>> >> >> >
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cordialement.
>> >> > Philippe Mouawad.
>> >>
>> >
>> >
>> >
>> > --
>> > Cordialement.
>> > Philippe Mouawad.
>>
>
>
>
> --
> Cordialement.
> Philippe Mouawad.

Re: svn commit: r1542839 - /jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java

Posted by Philippe Mouawad <ph...@gmail.com>.
On Sat, Nov 23, 2013 at 11:24 PM, sebb <se...@gmail.com> wrote:

> On 23 November 2013 21:31, Philippe Mouawad <ph...@gmail.com>
> wrote:
> > Hello sebb,
> >
> > I made the following test
> > I have a jdk7 in:
> > - /data/jdks/jdk7u25/
> >
> > I moved keytool to keytool.old.
> >
> > KeyToolUtils#checkKeytool returns true while it should return false no ?
>
> Yes, it should return false.
>
> > No exception is thrown and while stdout contains:
> > Unable to locate an executable at
> > "/data/jdks/jdk7u25/Contents/Home//bin/keytool" (-1)
>
> So if you capture the status what is its value?
>
> 2


> >
> >
> > On Sat, Nov 23, 2013 at 10:22 PM, sebb <se...@gmail.com> wrote:
> >
> >> On 23 November 2013 18:55, Philippe Mouawad <philippe.mouawad@gmail.com
> >
> >> wrote:
> >> > On Saturday, November 23, 2013, sebb wrote:
> >> >
> >> >> On 17 November 2013 21:51,  <pmouawad@apache.org <javascript:;>>
> 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.
> >> >>
> >> >> I added it because on macos it does not throw , so it didn't report
> any
> >> > error even if keytool was partly broken
> >>
> >> What do you mean by "partly broken" ?
> >>
> >> BTW, next time it would help if you documented the real reason in the
> >> log comment and the code when making a change.
> >>
> >> >>          } catch (IOException ioe) {
> >> >> >                 return false;
> >> >> >          } catch (InterruptedException e) {
> >> >> >
> >> >> >
> >> >>
> >> >
> >> >
> >> > --
> >> > Cordialement.
> >> > Philippe Mouawad.
> >>
> >
> >
> >
> > --
> > Cordialement.
> > Philippe Mouawad.
>



-- 
Cordialement.
Philippe Mouawad.

Re: svn commit: r1542839 - /jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java

Posted by sebb <se...@gmail.com>.
On 23 November 2013 21:31, Philippe Mouawad <ph...@gmail.com> wrote:
> Hello sebb,
>
> I made the following test
> I have a jdk7 in:
> - /data/jdks/jdk7u25/
>
> I moved keytool to keytool.old.
>
> KeyToolUtils#checkKeytool returns true while it should return false no ?

Yes, it should return false.

> No exception is thrown and while stdout contains:
> Unable to locate an executable at
> "/data/jdks/jdk7u25/Contents/Home//bin/keytool" (-1)

So if you capture the status what is its value?

>
>
> On Sat, Nov 23, 2013 at 10:22 PM, sebb <se...@gmail.com> wrote:
>
>> On 23 November 2013 18:55, Philippe Mouawad <ph...@gmail.com>
>> wrote:
>> > On Saturday, November 23, 2013, sebb wrote:
>> >
>> >> On 17 November 2013 21:51,  <pmouawad@apache.org <javascript:;>> 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.
>> >>
>> >> I added it because on macos it does not throw , so it didn't report any
>> > error even if keytool was partly broken
>>
>> What do you mean by "partly broken" ?
>>
>> BTW, next time it would help if you documented the real reason in the
>> log comment and the code when making a change.
>>
>> >>          } catch (IOException ioe) {
>> >> >                 return false;
>> >> >          } catch (InterruptedException e) {
>> >> >
>> >> >
>> >>
>> >
>> >
>> > --
>> > Cordialement.
>> > Philippe Mouawad.
>>
>
>
>
> --
> Cordialement.
> Philippe Mouawad.

Re: svn commit: r1542839 - /jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java

Posted by Philippe Mouawad <ph...@gmail.com>.
Hello sebb,

I made the following test
I have a jdk7 in:
- /data/jdks/jdk7u25/

I moved keytool to keytool.old.

KeyToolUtils#checkKeytool returns true while it should return false no ?
No exception is thrown and while stdout contains:
Unable to locate an executable at
"/data/jdks/jdk7u25/Contents/Home//bin/keytool" (-1)



On Sat, Nov 23, 2013 at 10:22 PM, sebb <se...@gmail.com> wrote:

> On 23 November 2013 18:55, Philippe Mouawad <ph...@gmail.com>
> wrote:
> > On Saturday, November 23, 2013, sebb wrote:
> >
> >> On 17 November 2013 21:51,  <pmouawad@apache.org <javascript:;>> 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.
> >>
> >> I added it because on macos it does not throw , so it didn't report any
> > error even if keytool was partly broken
>
> What do you mean by "partly broken" ?
>
> BTW, next time it would help if you documented the real reason in the
> log comment and the code when making a change.
>
> >>          } catch (IOException ioe) {
> >> >                 return false;
> >> >          } catch (InterruptedException e) {
> >> >
> >> >
> >>
> >
> >
> > --
> > Cordialement.
> > Philippe Mouawad.
>



-- 
Cordialement.
Philippe Mouawad.

Re: svn commit: r1542839 - /jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java

Posted by sebb <se...@gmail.com>.
On 23 November 2013 18:55, Philippe Mouawad <ph...@gmail.com> wrote:
> On Saturday, November 23, 2013, sebb wrote:
>
>> On 17 November 2013 21:51,  <pmouawad@apache.org <javascript:;>> 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.
>>
>> I added it because on macos it does not throw , so it didn't report any
> error even if keytool was partly broken

What do you mean by "partly broken" ?

BTW, next time it would help if you documented the real reason in the
log comment and the code when making a change.

>>          } catch (IOException ioe) {
>> >                 return false;
>> >          } catch (InterruptedException e) {
>> >
>> >
>>
>
>
> --
> Cordialement.
> Philippe Mouawad.

Re: svn commit: r1542839 - /jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java

Posted by Philippe Mouawad <ph...@gmail.com>.
On Saturday, November 23, 2013, sebb wrote:

> On 17 November 2013 21:51,  <pmouawad@apache.org <javascript:;>> 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.
>
> I added it because on macos it does not throw , so it didn't report any
error even if keytool was partly broken

>          } catch (IOException ioe) {
> >                 return false;
> >          } catch (InterruptedException e) {
> >
> >
>


-- 
Cordialement.
Philippe Mouawad.