protected boolean isExecutableValid(@NotNull String executable){
  try {
    GeneralCommandLine commandLine=new GeneralCommandLine();
    commandLine.setExePath(executable);
    CapturingProcessHandler handler=new CapturingProcessHandler(commandLine.createProcess(),CharsetToolkit.getDefaultSystemCharset());
    ProcessOutput result=handler.runProcess(60 * 1000);
    boolean timeout=result.isTimeout();
    int exitCode=result.getExitCode();
    String stderr=result.getStderr();
    if (timeout) {
      LOG.warn("Validation of " + executable + " failed with a timeout");
    }
    if (exitCode != 0) {
      LOG.warn("Validation of " + executable + " failed with non-zero exit code: "+ exitCode);
    }
    if (!stderr.isEmpty()) {
      LOG.warn("Validation of " + executable + " failed with a non-empty error output: "+ stderr);
    }
    return !timeout && exitCode == 0 && stderr.isEmpty();
  }
 catch (  Throwable t) {
    LOG.warn(t);
    return false;
  }
}

protected boolean isExecutableValid ( @ NotNull String executable ) { try { GeneralCommandLine commandLine = new GeneralCommandLine ( ) ; commandLine . setExePath ( executable ) ; CapturingProcessHandler handler = new CapturingProcessHandler ( commandLine . createProcess ( ) , CharsetToolkit . getDefaultSystemCharset ( ) ) ; ProcessOutput result = handler . runProcess ( 60 * 1000 ) ; boolean timeout = result . isTimeout ( ) ; int exitCode = result . getExitCode ( ) ; String stderr = result . getStderr ( ) ; if ( timeout ) { LOG . warn ( "Validation of " + executable + " failed with a timeout" ) ; } if ( exitCode != 0 ) { LOG . warn ( "Validation of " + executable + " failed with non-zero exit code: " + exitCode ) ; } if ( ! stderr . isEmpty ( ) ) { LOG . warn ( "Validation of " + executable + " failed with a non-empty error output: " + stderr ) ; } return ! timeout && exitCode == 0 && stderr . isEmpty ( ) ; } catch ( Throwable t ) { LOG . warn ( t ) ; return false ; } }
returns true if the supplied executable is valid . default implementation : try to execute the given executable and test if output returned errors . this can take a long time since it spawns external process .
