438 isSupported = true;
439 } else if (Platform.isS390x()) {
440 isSupported = true;
441 } else if (arch.equals("ppc64le")) {
442 isSupported = true;
443 }
444 }
445
446 if (isSupported) {
447 try {
448 isSupported = checkDockerSupport();
449 } catch (Exception e) {
450 isSupported = false;
451 }
452 }
453
454 return "" + isSupported;
455 }
456
457 private boolean checkDockerSupport() throws IOException, InterruptedException {
458 ProcessBuilder pb = new ProcessBuilder(Platform.DOCKER_COMMAND, "ps");
459 Process p = pb.start();
460 p.waitFor(10, TimeUnit.SECONDS);
461
462 return (p.exitValue() == 0);
463 }
464
465 private String implementor() {
466 try (InputStream in = new BufferedInputStream(new FileInputStream(
467 System.getProperty("java.home") + "/release"))) {
468 Properties properties = new Properties();
469 properties.load(in);
470 String implementorProperty = properties.getProperty("IMPLEMENTOR");
471 if (implementorProperty != null) {
472 return implementorProperty.replace("\"", "");
473 }
474 return errorWithMessage("Can't get 'IMPLEMENTOR' property from 'release' file");
475 } catch (IOException e) {
476 e.printStackTrace();
477 return errorWithMessage("Failed to read 'release' file " + e);
478 }
|
438 isSupported = true;
439 } else if (Platform.isS390x()) {
440 isSupported = true;
441 } else if (arch.equals("ppc64le")) {
442 isSupported = true;
443 }
444 }
445
446 if (isSupported) {
447 try {
448 isSupported = checkDockerSupport();
449 } catch (Exception e) {
450 isSupported = false;
451 }
452 }
453
454 return "" + isSupported;
455 }
456
457 private boolean checkDockerSupport() throws IOException, InterruptedException {
458 ProcessBuilder pb = new ProcessBuilder(Platform.Docker.DOCKER_COMMAND, "ps");
459 Process p = pb.start();
460 p.waitFor(10, TimeUnit.SECONDS);
461
462 return (p.exitValue() == 0);
463 }
464
465 private String implementor() {
466 try (InputStream in = new BufferedInputStream(new FileInputStream(
467 System.getProperty("java.home") + "/release"))) {
468 Properties properties = new Properties();
469 properties.load(in);
470 String implementorProperty = properties.getProperty("IMPLEMENTOR");
471 if (implementorProperty != null) {
472 return implementorProperty.replace("\"", "");
473 }
474 return errorWithMessage("Can't get 'IMPLEMENTOR' property from 'release' file");
475 } catch (IOException e) {
476 e.printStackTrace();
477 return errorWithMessage("Failed to read 'release' file " + e);
478 }
|