mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (formatting)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,12 +42,7 @@ import java.util.jar.Manifest;
|
||||
*/
|
||||
public class JdkVersionDetectorImpl extends JdkVersionDetector {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.projectRoots.impl.SdkVersionUtil");
|
||||
private static final ActionRunner ACTION_RUNNER = new ActionRunner() {
|
||||
@Override
|
||||
public Future<?> run(Runnable runnable) {
|
||||
return SharedThreadPool.getInstance().executeOnPooledThread(runnable);
|
||||
}
|
||||
};
|
||||
private static final ActionRunner ACTION_RUNNER = r -> SharedThreadPool.getInstance().executeOnPooledThread(r);
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
@@ -59,20 +54,14 @@ public class JdkVersionDetectorImpl extends JdkVersionDetector {
|
||||
public String detectJdkVersion(@NotNull String homePath, @NotNull ActionRunner runner) {
|
||||
File rtFile = new File(homePath, "jre/lib/rt.jar");
|
||||
if (rtFile.isFile()) {
|
||||
try {
|
||||
JarFile rtJar = new JarFile(rtFile, false);
|
||||
try {
|
||||
Manifest manifest = rtJar.getManifest();
|
||||
if (manifest != null) {
|
||||
String version = manifest.getMainAttributes().getValue("Implementation-Version");
|
||||
if (version != null) {
|
||||
return "java version \"" + version + "\"";
|
||||
}
|
||||
try (JarFile rtJar = new JarFile(rtFile, false)) {
|
||||
Manifest manifest = rtJar.getManifest();
|
||||
if (manifest != null) {
|
||||
String version = manifest.getMainAttributes().getValue("Implementation-Version");
|
||||
if (version != null) {
|
||||
return "java version \"" + version + "\"";
|
||||
}
|
||||
}
|
||||
finally {
|
||||
rtJar.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.info(e);
|
||||
|
||||
Reference in New Issue
Block a user