summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/kitfox/svg/SVGElement.java15
-rw-r--r--src/main/java/com/kitfox/svg/SVGUniverse.java10
-rw-r--r--src/main/java/com/kitfox/svg/ShapeElement.java10
3 files changed, 29 insertions, 6 deletions
diff --git a/src/main/java/com/kitfox/svg/SVGElement.java b/src/main/java/com/kitfox/svg/SVGElement.java
index 47ce1c3..08cb36c 100644
--- a/src/main/java/com/kitfox/svg/SVGElement.java
+++ b/src/main/java/com/kitfox/svg/SVGElement.java
@@ -267,7 +267,20 @@ abstract public class SVGElement implements Serializable
presAttribs.put(name, new StyleAttribute(name, value));
}
}
-
+
+ public void removeAttribute(String name, int attribType)
+ {
+ switch (attribType)
+ {
+ case AnimationElement.AT_CSS:
+ inlineStyles.remove(name);
+ return;
+ case AnimationElement.AT_XML:
+ presAttribs.remove(name);
+ return;
+ }
+ }
+
public void addAttribute(String name, int attribType, String value) throws SVGElementException
{
if (hasAttribute(name, attribType)) throw new SVGElementException(this, "Attribute " + name + "(" + AnimationElement.animationElementToString(attribType) + ") already exists");
diff --git a/src/main/java/com/kitfox/svg/SVGUniverse.java b/src/main/java/com/kitfox/svg/SVGUniverse.java
index f99279b..f59e0d1 100644
--- a/src/main/java/com/kitfox/svg/SVGUniverse.java
+++ b/src/main/java/com/kitfox/svg/SVGUniverse.java
@@ -35,7 +35,6 @@ import java.beans.PropertyChangeSupport;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
@@ -45,6 +44,7 @@ import java.io.Serializable;
import java.lang.ref.SoftReference;
import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
@@ -436,9 +436,13 @@ public class SVGUniverse implements Serializable
InputStream is = docRoot.openStream();
return loadSVG(uri, new InputSource(createDocumentInputStream(is)));
}
- catch (Throwable t)
+ catch (URISyntaxException ex)
{
- t.printStackTrace();
+ ex.printStackTrace();
+ }
+ catch (IOException ex)
+ {
+ ex.printStackTrace();
}
return null;
diff --git a/src/main/java/com/kitfox/svg/ShapeElement.java b/src/main/java/com/kitfox/svg/ShapeElement.java
index 07b76cf..eaa4832 100644
--- a/src/main/java/com/kitfox/svg/ShapeElement.java
+++ b/src/main/java/com/kitfox/svg/ShapeElement.java
@@ -129,7 +129,10 @@ abstract public class ShapeElement extends RenderableElement
AffineTransform xform = g.getTransform();
SVGElement ele = diagram.getUniverse().getElement(uri);
- fillPaint = ((FillElement)ele).getPaint(bounds, xform);
+ if (ele != null)
+ {
+ fillPaint = ((FillElement)ele).getPaint(bounds, xform);
+ }
}
}
}
@@ -165,7 +168,10 @@ abstract public class ShapeElement extends RenderableElement
AffineTransform xform = g.getTransform();
SVGElement ele = diagram.getUniverse().getElement(uri);
- strokePaint = ((FillElement)ele).getPaint(bounds, xform);
+ if (ele != null)
+ {
+ strokePaint = ((FillElement)ele).getPaint(bounds, xform);
+ }
}
}
}