URLEncoding in Icon URLs?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

URLEncoding in Icon URLs?

Felix Natter
Administrator
hi Devs,

we have four icons that needs to be URL encoded (i.e. 100%.svg).  For
PNG Icons, we create javax.swing.ImageIcon s, which works find with
unencoded URLs
(i.e. "bundleresource://5.fwk225905014:5/images/icons/100%.png").

However, svgSalamander does either:

URI uri = new URI(docRoot.toString());

or

URI uri = url.toURI()

(I tried with both)y

and this results in:

java.net.URISyntaxException: Malformed escape pair at index 52: bundleresource://5.fwk1769959310:12/images/icons/100%.svg
        at java.net.URI$Parser.fail(URI.java:2829)
        at java.net.URI$Parser.scanEscape(URI.java:2959)
        at java.net.URI$Parser.scan(URI.java:2982)
        at java.net.URI$Parser.checkChars(URI.java:3000)
        at java.net.URI$Parser.parseHierarchical(URI.java:3086)
        at java.net.URI$Parser.parse(URI.java:3034)
        at java.net.URI.<init>(URI.java:595)
        at com.kitfox.svg.SVGUniverse.loadSVG(SVGUniverse.java:461)
        at com.kitfox.svg.SVGUniverse.loadSVG(SVGUniverse.java:445)
        at org.freeplane.core.util.FreeplaneIconUtils.createSVGIcon(FreeplaneIconUtils.java:59)
        at org.freeplane.features.icon.factory.ImageIconFactory.getImageIcon(ImageIconFactory.java:62)
        at org.freeplane.features.icon.factory.ImageIconFactory.getImageIcon(ImageIconFactory.java:51)
        at org.freeplane.features.icon.mindmapmode.IconAction.<init>(IconAction.java:44)
        at org.freeplane.features.icon.mindmapmode.MIconController.createIconActions(MIconController.java:258)
        at org.freeplane.features.icon.mindmapmode.MIconController.<init>(MIconController.java:210)
        at org.freeplane.main.mindmapmode.MModeControllerFactory.createStandardControllers(MModeControllerFactory.java:230)
        at org.freeplane.main.mindmapmode.MModeControllerFactory.createModeControllerImpl(MModeControllerFactory.java:207)
        at org.freeplane.main.mindmapmode.MModeControllerFactory.createModeController(MModeControllerFactory.java:147)
        at org.freeplane.main.application.FreeplaneGUIStarter.createModeControllers(FreeplaneGUIStarter.java:230)
        at org.freeplane.main.osgi.ActivatorImpl.startFramework(ActivatorImpl.java:179)
        at org.freeplane.main.osgi.ActivatorImpl.start(ActivatorImpl.java:79)
        at org.freeplane.main.osgi.Activator.start(Activator.java:36)
        at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
        at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
        at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
        at org.eclipse.osgi.container.Module.doStart(Module.java:571)
        at org.eclipse.osgi.container.Module.start(Module.java:439)
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
        at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

Simply encoding the '%' (as '%25') results in:

java.io.FileNotFoundException: /images/icons/100%25.svg
        at org.eclipse.osgi.storage.url.bundleresource.Handler.findBundleEntry(Handler.java:44)
        at org.eclipse.osgi.storage.url.BundleResourceHandler.openConnection(BundleResourceHandler.java:169)
        at java.net.URL.openConnection(URL.java:982)
        at java.net.URL.openStream(URL.java:1048)
        at com.kitfox.svg.SVGUniverse.loadSVG(SVGUniverse.java:467)
        at com.kitfox.svg.SVGUniverse.loadSVG(SVGUniverse.java:445)


Concerning a workaround: I can't just rename those icons, as existing
mindmaps may reference it (yes, you can use these icons directly
without progress functionality).

Thanks and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Re: URLEncoding in Icon URLs?

Felix Natter
Administrator