Hi Helder,
having a look at the codesnippet below, you can see, that the exception raised
is not caused by a Null-Reference on the UpdateManager but because something
within the getAnimationEngine-Method is null. However this is not in the scope
of our code.
BTW:
Testing the UpdateManager not to be null like the way below, is a fairly common
way. There may be some very special situations, in which this test is not
enough (havily multithreaded environments, changing the tested variable very
often) but in this use case this test should be ok.
We initalize the variable at programm startup and nothing else ever happens
with it again.
As I though a wile, the UpdateManager of Batik is the counterpart to the
SwingUtilities.invokeLater-Method. The UpdateManager gets some updates to be
performed and it decides when to execute these updates. The programmer must
have no knowledge about the current execution situation of Batik.
Correct me if I'm wrong with this statement.
Thanks for your help
Florian
// stop animation engine, if any
UpdateManager updateMgr = this.getUpdateManager();
if (updateMgr != null)
{
try
{
BridgeContext bridgeContext = updateMgr.getBridgeContext();
AnimationEngine animationEngine = bridgeContext.getAnimationEngine();
animationEngine.pause();
}
catch (Exception e)
{
logger.log(Level.WARNING, "Error JSVGCanvas kickoffTransition", e);
}
}
java.lang.NullPointerException
at org.apache.batik.bridge.SVGAnimationEngine.<init>(Unknown Source)
[batik-all-jar-1.8.jar:1.8pre+r]
at
org.apache.batik.bridge.BridgeContext.getAnimationEngine(BridgeContext.java:726)
[batik-all-jar-1.8.jar:1.8pre+r]
.... (non batik code)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
Florian Pepping Wincor Nixdorf International GmbH
Banking Division Product Development (PSD5)
Phone: +49 5251 693 6471 Heinz-Nixdorf-Ring 1
Fax: +49 5251 693 6309 D-33106 Paderborn
[email protected] http://www.wincor-nixdorf.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
-----Original Message-----
From: Helder Magalhães [mailto:[email protected]]
Sent: Monday, January 12, 2009 10:39 PM
To: [email protected]
Subject: Re: Some current batik observations
> Hello Helder,
Hi Florian! :-)
I've just had a quick glance on the code (no real attempts on
reproducing the exception) and I still have a feeling that the problem
is a thread-unsafe operations (link on thread-safe recommendations in
previous message):
> if (updateMgr != null) //maybe not null here...
> {
> try
> {
//... but maybe null here! who knows? ;-D
> BridgeContext bridgeContext = updateMgr.getBridgeContext();
> AnimationEngine animationEngine = bridgeContext.getAnimationEngine();
> animationEngine.pause();
> }
My Java skills are pretty low but I guess one can't assume that, in a
multi-threaded environment, update manager will be available during
the whole invocation. That's why it seems that the code portion should
be within an "invokeLater" (or similar). Or am I missing something?
;-)
> Perhaps you can extract some problems there.
>
> Thanks
As stated, my Java knowledge doesn't allow me to go much further.
Aside from this preliminary guess, if following the recommended method
to manipulate the document still raises the exception (please post a
follow-up if so), than maybe someone else can shed some light on
this... :-)
> Florian Pepping
Hope this helps,
Helder Magalhães
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Stefan Auerbach, Dr. Jürgen
Wunram
Vorsitzender des Aufsichtsrats: Karl-Heinz Stiller
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193
Diese E-Mail enthält vertrauliche Informationen. Wenn Sie nicht der richtige
Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie
bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte
Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.
This e-mail may contain confidential information. If you are not the intended
recipient (or have received this e-mail in error) please notify the sender
immediately and destroy this e-mail. Any unauthorised copying, disclosure or
distribution of the material in this e-mail is strictly forbidden.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]