diff --git a/platform/util/src/com/intellij/util/lang/ClassPath.java b/platform/util/src/com/intellij/util/lang/ClassPath.java index 4f863bc4a768..7738f9cf6475 100644 --- a/platform/util/src/com/intellij/util/lang/ClassPath.java +++ b/platform/util/src/com/intellij/util/lang/ClassPath.java @@ -171,11 +171,10 @@ public class ClassPath { } return result; } - + /** - * Used in - * @see com.intellij.openapi.projectRoots.JdkUtil#isClassPathJarEnabled(java.util.List, java.lang.String) - * as condition that UrlClassLoader supports classpath jars. Please modify it accordingly + * Used in com.intellij.openapi.projectRoots.JdkUtil#isClassPathJarEnabled(List, String) + * as a condition that UrlClassLoader supports classpath jars. Please modify it accordingly. */ private void initLoaders(final URL url, boolean lastOne, int index) throws IOException { String path; @@ -375,14 +374,14 @@ public class ClassPath { } if (ourOrder == null) { - final File orderFile = new File(PathManager.getBinPath() + File.separator + "order.txt"); + final File orderFile = new File(PathManager.getBinPath(), "order.txt"); try { if (!FileUtil.ensureCanCreateFile(orderFile)) return; ourOrder = new PrintStream(new FileOutputStream(orderFile, true)); ShutDownTracker.getInstance().registerShutdownTask(new Runnable() { + @Override public void run() { - ourOrder.close(); - System.out.println(ourOrderSize); + closeOrderStream(); } }); } @@ -402,6 +401,11 @@ public class ClassPath { } } + @SuppressWarnings("UseOfSystemOutOrSystemErr") + private static synchronized void closeOrderStream() { + ourOrder.close(); + System.out.println(ourOrderSize); + } private static final boolean ourLogTiming = Boolean.getBoolean("idea.print.classpath.timing"); private static long ourTotalTime = 0; @@ -425,7 +429,7 @@ public class ClassPath { System.out.println(path.toString() + ", requests:" + ourTotalRequests + ", time:" + (ourTotalTime / 1000000) + "ms"); } } - + public static String[] loadManifestClasspath(File file) { try { JarInputStream inputStream = new JarInputStream(new FileInputStream(file)); @@ -445,5 +449,4 @@ public class ClassPath { catch (Exception ignore) { } return null; } - }