Handle URL from class loader with unescaped chars too

This commit is contained in:
Nikolay Krasko
2012-08-02 11:44:13 +04:00
parent b52b92cd31
commit 600349f5be
2 changed files with 12 additions and 7 deletions
@@ -42,9 +42,9 @@ import org.jetbrains.jet.lang.parsing.JetScriptDefinitionProvider;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetPsiUtil;
import org.jetbrains.jet.lang.resolve.AnalyzerScriptParameter;
import org.jetbrains.jet.lang.resolve.ScriptNameUtil;
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.ScriptNameUtil;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.plugin.JetMainDetector;
@@ -407,13 +407,17 @@ public class KotlinToJVMBytecodeCompiler {
if(loader instanceof URLClassLoader) {
for (URL url : ((URLClassLoader) loader).getURLs()) {
String urlFile;
try {
urlFile = url.toURI().getPath();
}
catch (URISyntaxException e) {
throw ExceptionUtils.rethrow(e);
String urlFile = url.getFile();
if (urlFile.contains("%")) {
try {
urlFile = url.toURI().getPath();
}
catch (URISyntaxException e) {
throw ExceptionUtils.rethrow(e);
}
}
File file = new File(urlFile);
if(file.exists() && (file.isDirectory() || file.getName().endsWith(".jar"))) {
files.add(file);