mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 15:27:16 -06:00
jsvg: use String instead of URL as cache key to avoid this problem: https://errorprone.info/bugpattern/URLEqualsHashCode
This commit is contained in:
@@ -63,7 +63,7 @@ public class FlatSVGIcon
|
|||||||
implements DisabledIconProvider
|
implements DisabledIconProvider
|
||||||
{
|
{
|
||||||
// cache that uses soft references for values, which allows freeing SVG documents if no longer used
|
// cache that uses soft references for values, which allows freeing SVG documents if no longer used
|
||||||
private static final SoftCache<URL, SVGDocument> svgCache = new SoftCache<>();
|
private static final SoftCache<String, SVGDocument> svgCache = new SoftCache<>();
|
||||||
private static final SVGLoader svgLoader = new SVGLoader();
|
private static final SVGLoader svgLoader = new SVGLoader();
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
@@ -485,7 +485,8 @@ public class FlatSVGIcon
|
|||||||
|
|
||||||
static synchronized SVGDocument loadSVG( URL url ) {
|
static synchronized SVGDocument loadSVG( URL url ) {
|
||||||
// get from our cache
|
// get from our cache
|
||||||
SVGDocument document = svgCache.get( url );
|
String cacheKey = url.toString();
|
||||||
|
SVGDocument document = svgCache.get( cacheKey );
|
||||||
if( document != null )
|
if( document != null )
|
||||||
return document;
|
return document;
|
||||||
|
|
||||||
@@ -497,7 +498,7 @@ public class FlatSVGIcon
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
svgCache.put( url, document );
|
svgCache.put( cacheKey, document );
|
||||||
|
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user