Skip to content

Commit 20841d4

Browse files
Michael5601HannesWell
authored andcommitted
change isSVGFile-Check to simple file-extension check
1 parent 281d992 commit 20841d4

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

bundles/org.eclipse.jface/src/org/eclipse/jface/resource/URLImageDescriptor.java

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
import org.eclipse.swt.graphics.ImageData;
4040
import org.eclipse.swt.graphics.ImageDataProvider;
4141
import org.eclipse.swt.graphics.ImageFileNameProvider;
42-
import org.eclipse.swt.graphics.SVGRasterizer;
43-
import org.eclipse.swt.graphics.SVGRasterizerRegistry;
4442

4543
/**
4644
* An ImageDescriptor that gets its information from a URL. This class is not
@@ -61,15 +59,8 @@ public URLImageFileNameProvider(String url) {
6159
public String getImagePath(int zoom) {
6260
URL tempURL = getURL(url);
6361
if (tempURL != null) {
64-
SVGRasterizer rasterizer = SVGRasterizerRegistry.getRasterizer();
65-
if (rasterizer != null) {
66-
try (InputStream in = getStream(tempURL)) {
67-
if (rasterizer.isSVGFile(in)) {
68-
return getFilePath(tempURL, false);
69-
}
70-
} catch (IOException e) {
71-
// ignore.
72-
}
62+
if (tempURL.toString().endsWith(".svg")) { //$NON-NLS-1$
63+
return getFilePath(tempURL, false);
7364
}
7465
final boolean logIOException = zoom == 100;
7566
if (zoom == 100) {
@@ -151,15 +142,8 @@ public ImageData getImageData(int zoom) {
151142
private static ImageData getImageData(String url, int zoom) {
152143
URL tempURL = getURL(url);
153144
if (tempURL != null) {
154-
SVGRasterizer rasterizer = SVGRasterizerRegistry.getRasterizer();
155-
if (rasterizer != null) {
156-
try (InputStream in = getStream(tempURL)) {
157-
if (rasterizer.isSVGFile(in)) {
158-
return getImageData(tempURL, zoom);
159-
}
160-
} catch (IOException e) {
161-
// ignore.
162-
}
145+
if (tempURL.toString().endsWith(".svg")) { //$NON-NLS-1$
146+
return getImageData(tempURL, zoom);
163147
}
164148
if (zoom == 100) {
165149
return getImageData(tempURL, zoom);

0 commit comments

Comments
 (0)