As far as I understand ImageWriterRegistry provides the static factory
method getInstance() to setup and return an ImageWriterRegistry Object
which is a light wrapper around a HashMap filled with supported
ImageWriters. The Map is populated in setup(), called by the
constructor. I think this is done in order for the ImageWriter instances
to be Singletons.
As the code in ImageWriterRegistry looks fine to me, I can see two
potential reasons why you get a null-reference:
- you use an old version of Batik
- you have class-loader issues
Hope this helps...
Daniel
Eric Hamacher wrote:
ImageWriterRegistry.getInstance() is a do-nothing method! Is there something I
don't know about?
The offending line is line 89/90 in
org.apache.batik.transcoder.image.JPEGTranscoder . . .
ImageWriter writer = ImageWriterRegistry.getInstance()
.getWriterFor("image/jpeg");
returns a null ImageWriter. I'm not sure why.
-----Original Message-----
From: Cameron McCormack [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 05, 2008 9:26 PM
To: [email protected]
Subject: Re: org.apache.batik.transcoder.TranscoderException: null
Hi Eric.
Eric Hamacher:
I get the following exception using Batik (1.7) at the line
"t.transcode(input, output);" I am trying to convert a DOM into a
JPEG image.
org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
null
08/03/05 10:42:08 at
org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTransco
der.java:
132)
…
Anybody have an idea about what this exception is about? Thanks
It’s hard to tell, since the (what I assume is a) NullPointerException
is wrapped in a TranscoderException, which doesn’t show where the NPE
was thrown. If you can compile Batik, try adding a line
ex.printStackTrace();
just before the throw line in
ImageTranscoder.transcode(Document,String,TranscoderOutput), and that at
least will show where the original exception is being thrown.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]