[platform] fixes noisy nested .jar logging

This commit is contained in:
Roman Shevchenko
2016-05-25 18:56:09 +03:00
parent 93b1c760af
commit 3e1882a01b
2 changed files with 13 additions and 5 deletions
@@ -28,6 +28,8 @@ import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
public class CommandLineWrapperUtil {
public static final Attributes.Name IJ_CLASS_PATH_JAR = new Attributes.Name("IntellijJ-Class-Path-Jar");
@NotNull
public static File createClasspathJarFile(Manifest manifest, List<String> pathList) throws IOException {
return createClasspathJarFile(manifest, pathList, false);
@@ -47,6 +49,8 @@ public class CommandLineWrapperUtil {
}
manifest.getMainAttributes().put(Attributes.Name.CLASS_PATH, classPath.toString());
manifest.getMainAttributes().put(IJ_CLASS_PATH_JAR, "true");
File jarFile = FileUtil.createTempFile("classpath", ".jar", true);
new JarOutputStream(new BufferedOutputStream(new FileOutputStream(jarFile)), manifest).close();
return jarFile;
@@ -15,6 +15,7 @@
*/
package com.intellij.util.lang;
import com.intellij.execution.CommandLineWrapperUtil;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.ShutDownTracker;
@@ -220,7 +221,7 @@ public class ClassPath {
}
}
catch (Exception e) {
Logger.getInstance(ClassPath.class).info("url: " + url + " / " + referencedJar, e);
Logger.getInstance(ClassPath.class).warn("url: " + url + " / " + referencedJar, e);
}
}
}
@@ -430,11 +431,14 @@ public class ClassPath {
try {
JarInputStream inputStream = new JarInputStream(new FileInputStream(file));
try {
final Manifest manifest = inputStream.getManifest();
Manifest manifest = inputStream.getManifest();
if (manifest != null) {
final String classPath = manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH);
if (classPath != null) {
return classPath.split(" ");
String signature = manifest.getMainAttributes().getValue(CommandLineWrapperUtil.IJ_CLASS_PATH_JAR);
if (Boolean.parseBoolean(signature)) {
String classPath = manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH);
if (classPath != null) {
return classPath.split(" ");
}
}
}
}