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 philip zuniga <ph...@gmail.com> on 2006/05/26 06:05:10 UTC

null pointer assignment when decreasing the viewbox

Good day.

I have a function in my java code that adjusts the viewbox attribute of my
SVG document. This function changes the 3rd parameter of the viewbox
attribute and the width of the SVG file:

setWidth( Integer x )
{
root.setAttribute("viewBox", "0,0," + x.toString() + ",0");
root.setAttribute("width", x.toString());
}

I noticed that when I increase the x, the viewbox and the width increases
accordingly. But when I decrease my x attribute I get a null pointer
assignment error, do you know why I get such an error?

Thanks
Philip Zuniga

Re: null pointer assignment when decreasing the viewbox

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

"philip zuniga" <ph...@gmail.com> wrote on 05/26/2006 12:08:07 PM:


> here is the trace of the error:
> 
> java.lang.NullPointerException
> at java.awt.geom.AffineTransform.<init>(Unknown Source)
> at org.apache.batik.bridge.SVGSVGElementBridge.
>    handleDOMAttrModifiedEvent(Unknown Source)

   It looks like this might be fixed in SVN already.  I would
suggest testing with the latest 'trunk' or 'branches/svg11'
code.

> Philip Zuniga
> 
> On 5/26/06, thomas.deweese@kodak.com <thomas.deweese@kodak.com > wrote: 
> Hi Philip,
> 
> "philip zuniga" <philip.zuniga@gmail.com > wrote on 05/26/2006 12:05:10 
AM:
> 
> > I have a function in my java code that adjusts the viewbox attribute 
of
> my SVG
> > document. This function changes the 3rd parameter of the viewbox
> attribute and 
> > the width of the SVG file:
> >
> > setWidth( Integer x )
> > {
> > root.setAttribute("viewBox", "0,0," + x.toString() + ",0");
> 
>    This doesn't look particularly good to me, the 'height' of 
> your viewBox is being set to zero, which might cause some problems....
> 
> > I noticed that when I increase the x, the viewbox and the width
> increases
> > accordingly. But when I decrease my x attribute I get a null pointer 
> > assignment error, do you know why I get such an error?
> 
>    Not with any confidence (the above might be part of it),
> but if you provide the stack trace I might be able to.
> 
> 
> --------------------------------------------------------------------- 
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


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


Re: null pointer assignment when decreasing the viewbox

Posted by philip zuniga <ph...@gmail.com>.
Hello sir,
sorry there was a typographical error in my mail, the function is supposed
to be like this:
setWidth( Integer x )
{
root.setAttribute("viewBox", "0,0," + x.toString() + ",250");
root.setAttribute("width", x.toString());
}

I set the height by some constant value. Btw, here is the trace of the
error:


java.lang.NullPointerException

at java.awt.geom.AffineTransform.<init>(Unknown Source)

at org.apache.batik.bridge.SVGSVGElementBridge.handleDOMAttrModifiedEvent(Unknown
Source)

at
org.apache.batik.bridge.BridgeContext$DOMAttrModifiedEventListener.handleEvent(Unknown
Source)

at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown
Source)

at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)

at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)

at org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(Unknown
Source)

at org.apache.batik.dom.AbstractAttr.setNodeValue(Unknown Source)

at org.apache.batik.dom.AbstractAttr.setValue(Unknown Source)

at org.apache.batik.dom.AbstractElement.setAttribute(Unknown Source)

at com.tillphotonics.gpe.document.ProtocolScoreViewDocument.setViewBox(
ProtocolScoreViewDocument.java:237)

at com.tillphotonics.gpe.ProtocolScoreView$zoomOut.handleEvent(
ProtocolScoreView.java:133)

at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown
Source)

at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)

at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)

at org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown
Source)

at org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(Unknown
Source)

at org.apache.batik.bridge.BridgeEventSupport$Listener.mouseClicked(Unknown
Source)

at org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(Unknown
Source)

at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(Unknown
Source)

at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(Unknown
Source)

at org.apache.batik.gvt.event.AWTEventDispatcher.mouseClicked(Unknown
Source)

at org.apache.batik.swing.svg.JSVGComponent$17.run(Unknown Source)

at org.apache.batik.util.RunnableQueue.run(Unknown Source)

at java.lang.Thread.run(Unknown Source

Thanks a lot.

Philip Zuniga

On 5/26/06, thomas.deweese@kodak.com <th...@kodak.com> wrote:
>
> Hi Philip,
>
> "philip zuniga" <ph...@gmail.com> wrote on 05/26/2006 12:05:10 AM:
>
> > I have a function in my java code that adjusts the viewbox attribute of
> my SVG
> > document. This function changes the 3rd parameter of the viewbox
> attribute and
> > the width of the SVG file:
> >
> > setWidth( Integer x )
> > {
> > root.setAttribute("viewBox", "0,0," + x.toString() + ",0");
>
>    This doesn't look particularly good to me, the 'height' of
> your viewBox is being set to zero, which might cause some problems....
>
> > I noticed that when I increase the x, the viewbox and the width
> increases
> > accordingly. But when I decrease my x attribute I get a null pointer
> > assignment error, do you know why I get such an error?
>
>    Not with any confidence (the above might be part of it),
> but if you provide the stack trace I might be able to.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>

Re: null pointer assignment when decreasing the viewbox

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

"philip zuniga" <ph...@gmail.com> wrote on 05/26/2006 12:05:10 AM:

> I have a function in my java code that adjusts the viewbox attribute of 
my SVG
> document. This function changes the 3rd parameter of the viewbox 
attribute and
> the width of the SVG file:
> 
> setWidth( Integer x )
> {
> root.setAttribute("viewBox", "0,0," + x.toString() + ",0");

    This doesn't look particularly good to me, the 'height' of
your viewBox is being set to zero, which might cause some problems....

> I noticed that when I increase the x, the viewbox and the width 
increases 
> accordingly. But when I decrease my x attribute I get a null pointer 
> assignment error, do you know why I get such an error?

    Not with any confidence (the above might be part of it), 
but if you provide the stack trace I might be able to.


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