summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkitfox2009-03-19 04:23:58 +0100
committerkitfox2009-03-19 04:23:58 +0100
commit1259861007526f01bc916894e2010966f1a1f8f2 (patch)
tree772c388d45eaf1d1b33848d6a50e7ae51e637e99
parentShould now be possible to set id attribute even if element has not yet been a... (diff)
downloadsvg-salamander-core-1259861007526f01bc916894e2010966f1a1f8f2.tar.gz
svg-salamander-core-1259861007526f01bc916894e2010966f1a1f8f2.tar.xz
svg-salamander-core-1259861007526f01bc916894e2010966f1a1f8f2.zip
Work around for running in webstart to handle URLs to the source jar where the path to the jar is hidden.
git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@61 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b
-rw-r--r--src/main/java/com/kitfox/svg/SVGUniverse.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main/java/com/kitfox/svg/SVGUniverse.java b/src/main/java/com/kitfox/svg/SVGUniverse.java
index 9ca3126..ed6c0ce 100644
--- a/src/main/java/com/kitfox/svg/SVGUniverse.java
+++ b/src/main/java/com/kitfox/svg/SVGUniverse.java
@@ -33,17 +33,16 @@ import java.awt.image.BufferedImage;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.BufferedInputStream;
-import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Reader;
import java.io.Serializable;
import java.lang.ref.SoftReference;
+import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
@@ -296,14 +295,25 @@ public class SVGUniverse implements Serializable
public SVGDiagram getDiagram(URI xmlBase, boolean loadIfAbsent)
{
if (xmlBase == null) return null;
-
+
SVGDiagram dia = (SVGDiagram)loadedDocs.get(xmlBase);
if (dia != null || !loadIfAbsent) return dia;
//Load missing diagram
try
{
- URL url = xmlBase.toURL();
+ URL url;
+ if ("jar".equals(xmlBase.getScheme()) && !xmlBase.getPath().contains("!/"))
+ {
+ //Workaround for resources stored in jars loaded by Webstart.
+ //http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6753651
+ url = SVGUniverse.class.getResource("xmlBase.getPath()");
+ }
+ else
+ {
+ url = xmlBase.toURL();
+ }
+
loadSVG(url, false);
dia = (SVGDiagram)loadedDocs.get(xmlBase);