mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
intern URL protocol
This commit is contained in:
@@ -23,6 +23,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.PluginDescriptor;
|
||||
import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.lang.UrlClassLoader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -162,9 +163,9 @@ public class FileTemplatesLoader {
|
||||
final String filename = path.substring(prefix.length(), path.length() - FTManager.TEMPLATE_EXTENSION_SUFFIX.length());
|
||||
final String extension = myTypeManager.getExtension(filename);
|
||||
final String templateName = filename.substring(0, filename.length() - extension.length() - 1);
|
||||
final URL templateUrl = new URL(root.toExternalForm() + "/" + path);
|
||||
final URL templateUrl = UrlClassLoader.internProtocol(new URL(root.toExternalForm() + "/" + path));
|
||||
final String descriptionPath = getDescriptionPath(prefix, templateName, extension, descriptionPaths);
|
||||
final URL descriptionUrl = descriptionPath != null ? new URL(root.toExternalForm() + "/" + descriptionPath) : null;
|
||||
final URL descriptionUrl = descriptionPath != null ? UrlClassLoader.internProtocol(new URL(root.toExternalForm() + "/" + descriptionPath)) : null;
|
||||
entry.getValue().addDefaultTemplate(new DefaultTemplate(templateName, extension, templateUrl, descriptionUrl));
|
||||
}
|
||||
break; // FTManagers loop
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.intellij.util.containers.Convertor;
|
||||
import com.intellij.util.io.URLUtil;
|
||||
import com.intellij.util.io.fs.FileSystem;
|
||||
import com.intellij.util.io.fs.IFile;
|
||||
import com.intellij.util.lang.UrlClassLoader;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -387,10 +388,10 @@ public class VfsUtil extends VfsUtilCore {
|
||||
|
||||
try {
|
||||
if (protocol.equals(StandardFileSystems.FILE_PROTOCOL)) {
|
||||
return new URL(protocol, "", path);
|
||||
return new URL(StandardFileSystems.FILE_PROTOCOL, "", path);
|
||||
}
|
||||
else {
|
||||
return new URL(vfsUrl);
|
||||
return UrlClassLoader.internProtocol(new URL(vfsUrl));
|
||||
}
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
|
||||
Reference in New Issue
Block a user