eirikbakke commented on pull request #2817: URL: https://github.com/apache/netbeans/pull/2817#issuecomment-802465844
Looks fine. I had a look at BATIK-1276, which was the main change you mentioned in the JIRA issue: https://github.com/apache/xmlgraphics-batik/commit/bc6078ca949039e2076cd08b4cb169c84c1179b1 NetBeans' own SVGIcon class does not use the classes in question. But it would be nice and to do something analogous there, i.e.: ``` diff --git a/platform/openide.util.ui.svg/src/org/openide/util/svg/SVGIcon.java b/platform/openide.util.ui.svg/src/org/openide/util/svg/SVGIcon.java index f6e0347..4bdc7d9 100644 --- a/platform/openide.util.ui.svg/src/org/openide/util/svg/SVGIcon.java +++ b/platform/openide.util.ui.svg/src/org/openide/util/svg/SVGIcon.java @@ -38,11 +38,14 @@ import javax.swing.Icon; import org.apache.batik.anim.dom.SAXSVGDocumentFactory; import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.DocumentLoader; +import org.apache.batik.bridge.ExternalResourceSecurity; import org.apache.batik.bridge.GVTBuilder; +import org.apache.batik.bridge.NoLoadExternalResourceSecurity; import org.apache.batik.bridge.UserAgent; import org.apache.batik.bridge.UserAgentAdapter; import org.apache.batik.ext.awt.image.GraphicsUtil; import org.apache.batik.gvt.GraphicsNode; +import org.apache.batik.util.ParsedURL; import org.apache.batik.util.XMLResourceDescriptor; import org.openide.util.CachedHiDPIIcon; import org.openide.util.Parameters; @@ -137,7 +140,14 @@ final class SVGIcon extends CachedHiDPIIcon { /* Don't provide an URI here; we shouldn't commit to supporting relative links from loaded SVG documents. */ doc = factory.createDocument(null, is); - UserAgent userAgent = new UserAgentAdapter(); + UserAgent userAgent = new UserAgentAdapter() { + @Override + public ExternalResourceSecurity getExternalResourceSecurity( + ParsedURL resourceURL, ParsedURL docURL) + { + return new NoLoadExternalResourceSecurity(); + } + }; DocumentLoader loader = new DocumentLoader(userAgent); BridgeContext bctx = new BridgeContext(userAgent, loader); try { ``` Since SVGIcon is only currently used on icon files we provide ourselves, this won't currently make a difference. But it would be nice to do if we ever start using SVGIcon to load arbitrary external SVG files. I can add this the next time I'm working on NetBeans. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
