jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1542839 - /jmeter/trunk/src/jorphan/org/apache/jorphan/exec/KeyToolUtils.java
Date Sat, 23 Nov 2013 23:19:04 GMT
On 23 November 2013 23:02, Philippe Mouawad <philippe.mouawad@gmail.com> wrote:
> On Sat, Nov 23, 2013 at 11:24 PM, sebb <sebbaz@gmail.com> wrote:
>
>> On 23 November 2013 21:31, Philippe Mouawad <philippe.mouawad@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 <sebbaz@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.

Mime
View raw message