You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Raphael Matter <ma...@googlemail.com> on 2009/01/27 15:27:41 UTC

NullPointer when setting class attribute of -tag

Hi,

i try to set the class-attribute of a use element in my EventListener, like:

public void handleEvent(Event evt) {
        Element target = (Element)evt.getCurrentTarget();
        target.setAttribute("class", classAttrib);   //Exception here!!!
    } }

..but i run into the following exception:

java.lang.NullPointerException
    at
org.apache.batik.bridge.SVGUseElementBridge.handleAnimatedAttributeChanged(SVGUseElementBridge.java:456)
    at
org.apache.batik.bridge.BridgeContext$AnimatedAttrListener.animatedAttributeChanged(BridgeContext.java:1763)
    at
org.apache.batik.dom.svg.SVGOMDocument$AnimAttrListener.animatedAttributeChanged(SVGOMDocument.java:706)
    at
org.apache.batik.dom.svg.AbstractSVGAnimatedValue.fireAnimatedAttributeListeners(AbstractSVGAnimatedValue.java:132)
    at
org.apache.batik.dom.svg.SVGOMAnimatedString.attrModified(SVGOMAnimatedString.java:115)
    at
org.apache.batik.dom.svg.AbstractElement.attrModified(AbstractElement.java:238)
    at
org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(AbstractElement.java:627)
    at
org.apache.batik.dom.svg.AbstractElement.fireDOMAttrModifiedEvent(AbstractElement.java:117)
    at org.apache.batik.dom.AbstractAttr.setNodeValue(AbstractAttr.java:156)
    at org.apache.batik.dom.AbstractAttr.setValue(AbstractAttr.java:199)
    at
org.apache.batik.dom.AbstractElement.setAttribute(AbstractElement.java:144)
    at OnHoverAction.handleEvent(OnHoverAction.java:30)
    at
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.java:324)
    at
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.java:366)
    at
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:276)
    at
org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:1014)
    at
org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(BridgeEventSupport.java:405)
    at
org.apache.batik.bridge.BridgeEventSupport$Listener.mouseEntered(BridgeEventSupport.java:266)
    at
org.apache.batik.gvt.event.AbstractAWTEventDispatcher.processMouseEvent(AbstractAWTEventDispatcher.java:592)
    at
org.apache.batik.gvt.event.AbstractAWTEventDispatcher.dispatchMouseEvent(AbstractAWTEventDispatcher.java:523)
    at
org.apache.batik.gvt.event.AbstractAWTEventDispatcher.dispatchEvent(AbstractAWTEventDispatcher.java:387)
    at
org.apache.batik.gvt.event.AbstractAWTEventDispatcher.mouseMoved(AbstractAWTEventDispatcher.java:210)
    at
org.apache.batik.swing.svg.AbstractJSVGComponent$1$MouseMovedRunnable.run(AbstractJSVGComponent.java:2248)
    at org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:237)
    at java.lang.Thread.run(Unknown Source)

seems only  to happen for use-elements.
does anyboy know what could be wrong here?

thanks a lot
raphael

Re: NullPointer when setting class attribute of -tag

Posted by Helder Magalhães <he...@gmail.com>.
> seems only  to happen for use-elements.

Could you attach a simple test case which reproduces the exception? A
working sample (Java code and/or SVG file, if not completely generated
by code) would be great. It generally helps towards getting more
valuable feedback, as creating a test case which reproduces the issue
is sometimes not trivial or even possible at all; also, the attempt to
reduce the problem to the simplest test case in many cases reveals
that the problem wasn't in the initially though!). ;-)

Regards,

 Helder

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: NullPointer when setting class attribute of -tag

Posted by iphar <ma...@googlemail.com>.
Hi Thomas,

yes, due to your fix it works now with the latest version of the trunk! 

thanks a lot!


thomas.deweese wrote:
> 
> Hi Raphael,
> 
>    I believe this is now fixed in SVN.  Please update to the
> latest version on trunk and report back if possible.
> 
> 

-- 
View this message in context: http://www.nabble.com/NullPointer-when-setting-class-attribute-of-%3Cuse%3E-tag-tp21686976p21707102.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: NullPointer when setting class attribute of -tag

Posted by th...@kodak.com.
Hi Raphael,

Raphael Matter <ma...@googlemail.com> wrote on 01/27/2009 09:27:41 AM:

> i try to set the class-attribute of a use element in my 
EventListener[...]
> ..but i run into the following exception:
> 
> java.lang.NullPointerException
>     at org.apache.batik.bridge.SVGUseElementBridge.
>         handleAnimatedAttributeChanged(SVGUseElementBridge.java:456)

   I believe this is now fixed in SVN.  Please update to the
latest version on trunk and report back if possible.