You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by ca...@apache.org on 2006/08/08 08:50:15 UTC

svn commit: r429600 - in /xmlgraphics/batik/trunk/sources/org/apache/batik: anim/timing/TimedElement.java css/engine/CSSEngine.java dom/svg/SVGStylableElement.java

Author: cam
Date: Mon Aug  7 23:50:14 2006
New Revision: 429600

URL: http://svn.apache.org/viewvc?rev=429600&view=rev
Log:
1. Better exception reporting for animation element timing attribute errors.
2. Fix for NPE with override stylesheet processing.

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/anim/timing/TimedElement.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/CSSEngine.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGStylableElement.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/anim/timing/TimedElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/anim/timing/TimedElement.java?rev=429600&r1=429599&r2=429600&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/anim/timing/TimedElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/anim/timing/TimedElement.java Mon Aug  7 23:50:14 2006
@@ -923,12 +923,18 @@
      * Parses a new 'begin' attribute.
      */
     protected void parseBegin(String begin) {
-        if (begin.length() == 0) {
-            begin = SMIL_BEGIN_DEFAULT_VALUE;
+        try {
+            if (begin.length() == 0) {
+                begin = SMIL_BEGIN_DEFAULT_VALUE;
+            }
+            beginTimes = TimingSpecifierListProducer.parseTimingSpecifierList
+                (TimedElement.this, true, begin,
+                 root.useSVG11AccessKeys, root.useSVG12AccessKeys);
+        } catch (ParseException ex) {
+            throw createException
+                ("attribute.malformed",
+                 new Object[] { null, SMIL_BEGIN_ATTRIBUTE });
         }
-        beginTimes = TimingSpecifierListProducer.parseTimingSpecifierList
-            (TimedElement.this, true, begin,
-             root.useSVG11AccessKeys, root.useSVG12AccessKeys);
     }
 
     /**
@@ -978,9 +984,15 @@
      * Parses a new 'end' attribute.
      */
     protected void parseEnd(String end) {
-        endTimes = TimingSpecifierListProducer.parseTimingSpecifierList
-            (TimedElement.this, false, end,
-             root.useSVG11AccessKeys, root.useSVG12AccessKeys);
+        try {
+            endTimes = TimingSpecifierListProducer.parseTimingSpecifierList
+                (TimedElement.this, false, end,
+                 root.useSVG11AccessKeys, root.useSVG12AccessKeys);
+        } catch (ParseException ex) {
+            throw createException
+                ("attribute.malformed",
+                 new Object[] { null, SMIL_END_ATTRIBUTE });
+        }
     }
 
     /**
@@ -994,7 +1006,13 @@
             if (min.length() == 0) {
                 this.min = 0;
             } else {
-                this.min = parseClockValue(min);
+                try {
+                    this.min = parseClockValue(min);
+                } catch (ParseException ex) {
+                    throw createException
+                        ("attribute.malformed",
+                         new Object[] { null, SMIL_MIN_ATTRIBUTE });
+                }
                 if (this.min < 0) {
                     this.min = 0;
                 }
@@ -1013,7 +1031,13 @@
             if (max.length() == 0 || max.equals(SMIL_INDEFINITE_VALUE)) {
                 this.max = INDEFINITE;
             } else {
-                this.max = parseClockValue(max);
+                try {
+                    this.max = parseClockValue(max);
+                } catch (ParseException ex) {
+                    throw createException
+                        ("attribute.malformed",
+                         new Object[] { null, SMIL_MAX_ATTRIBUTE });
+                }
                 if (this.max < 0) {
                     this.max = 0;
                 }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/CSSEngine.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/CSSEngine.java?rev=429600&r1=429599&r2=429600&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/CSSEngine.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/css/engine/CSSEngine.java Mon Aug  7 23:50:14 2006
@@ -57,7 +57,6 @@
 import org.w3c.dom.events.EventTarget;
 import org.w3c.dom.events.MutationEvent;
 
-
 /**
  * This is the base class for all the CSS engines.
  *
@@ -2532,7 +2531,8 @@
                 if (idx == declaration.getIndex(i)) {
                     declaration.remove(i);
                     StyleMap style = elt.getComputedStyleMap(null);
-                    if (style.getOrigin(idx) == StyleMap.OVERRIDE_ORIGIN
+                    if (style != null
+                            && style.getOrigin(idx) == StyleMap.OVERRIDE_ORIGIN
                             && style.isComputed(idx)) {
                         invalidateProperties
                             (elt, new int[] { idx }, null, true);

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGStylableElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGStylableElement.java?rev=429600&r1=429599&r2=429600&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGStylableElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGStylableElement.java Mon Aug  7 23:50:14 2006
@@ -173,7 +173,6 @@
      */
     public void updatePropertyValue(String pn, AnimatableValue val) {
         CSSStyleDeclaration over = getOverrideStyle();
-        //System.err.println(e.getAttributeNS(null, "id") + "." + pn + " val is " + val);
         if (val == null) {
             over.removeProperty(pn);
         } else {