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 <[email protected]> wrote: > On 23 November 2013 18:55, Philippe Mouawad <[email protected]> > wrote: > > On Saturday, November 23, 2013, sebb wrote: > > > >> On 17 November 2013 21:51, <[email protected] <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.
