mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-275516 plugin manager does not display a plugin icon and org.apache.batik.bridge.BridgeException is thrown
GitOrigin-RevId: eb3f005d823586b2b59a8c905bd3ef3325c9c523
This commit is contained in:
committed by
intellij-monorepo-bot
parent
19c03154c0
commit
80fd13103d
@@ -133,7 +133,7 @@ public final class PluginLogo {
|
||||
String fileName = file.getFileName().toString();
|
||||
Path darkFile = file.getParent().resolve(fileName.substring(0, fileName.length() - 4) + "_dark.svg");
|
||||
try (InputStream stream = Files.newInputStream(darkFile)) {
|
||||
return HiDPIPluginLogoIcon.loadSVG(darkFile.toUri().toURL(), stream, width, height);
|
||||
return HiDPIPluginLogoIcon.loadSVG(toURL(darkFile), stream, width, height);
|
||||
}
|
||||
catch (NoSuchFileException ignore) {
|
||||
}
|
||||
@@ -361,12 +361,20 @@ public final class PluginLogo {
|
||||
@Nullable
|
||||
private static PluginLogoIconProvider tryLoadIcon(@NotNull ZipFile zipFile, boolean light) {
|
||||
ZipEntry iconEntry = zipFile.getEntry(getIconFileName(light));
|
||||
return iconEntry == null ? null : loadFileIcon(toURL(new File(zipFile.getName())), () -> zipFile.getInputStream(iconEntry));
|
||||
return iconEntry == null ? null : loadFileIcon(toURL(zipFile), () -> zipFile.getInputStream(iconEntry));
|
||||
}
|
||||
|
||||
static @Nullable URL toURL(@NotNull File file) {
|
||||
static @Nullable URL toURL(@NotNull Object file) {
|
||||
try {
|
||||
return file.toURI().toURL();
|
||||
if (file instanceof File) {
|
||||
return ((File)file).toURI().toURL();
|
||||
}
|
||||
if (file instanceof Path) {
|
||||
return ((Path)file).toUri().toURL();
|
||||
}
|
||||
if (file instanceof ZipFile) {
|
||||
return new File(((ZipFile)file).getName()).toURI().toURL();
|
||||
}
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
LOG.warn(e);
|
||||
|
||||
@@ -116,7 +116,7 @@ public final class PluginLogoApi {
|
||||
private @Nullable Icon tryLoadIcon(@NotNull Path dirFile, boolean light, int width, int height) {
|
||||
try {
|
||||
Path iconFile = dirFile.resolve(PluginLogo.getIconFileName(light));
|
||||
return Files.size(iconFile) > 0 ? loadFileIcon(iconFile.toUri().toURL(), Files.newInputStream(iconFile), width, height) : null;
|
||||
return Files.size(iconFile) > 0 ? loadFileIcon(PluginLogo.toURL(iconFile), Files.newInputStream(iconFile), width, height) : null;
|
||||
}
|
||||
catch (NoSuchFileException ignore) {
|
||||
return null;
|
||||
@@ -131,7 +131,7 @@ public final class PluginLogoApi {
|
||||
|
||||
private @Nullable static Icon tryLoadIcon(@NotNull ZipFile zipFile, boolean light, int width, int height) throws IOException {
|
||||
ZipEntry iconEntry = zipFile.getEntry(PluginLogo.getIconFileName(light));
|
||||
return iconEntry == null ? null : loadFileIcon(PluginLogo.toURL(new File(zipFile.getName())), zipFile.getInputStream(iconEntry), width, height);
|
||||
return iconEntry == null ? null : loadFileIcon(PluginLogo.toURL(zipFile), zipFile.getInputStream(iconEntry), width, height);
|
||||
}
|
||||
|
||||
private @NotNull static Icon loadFileIcon(@Nullable URL url, @NotNull InputStream stream, int width, int height) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user