>>>>> "GA" == George Armhold <[EMAIL PROTECTED]> writes:

GA> Hi, I was running into frequent ArrayIndexOutOfBoundsException
GA> when using Batik-1.0.  

    First off Batik 1.0 is getting pretty old now. I strongly suggest
using one of 1.1 rc releases.

GA> Here are two typical stack traces:

    You appear to have trimmed the stack traces...

GA> org.apache.batik.svggen.SVGGraphics2D.getTopLevelGroup(SVGGraphics2D.java:373)

    Who is calling this???

GA> org.apache.batik.svggen.SVGGraphics2D.fill(SVGGraphics2D.java:1019)

    Who is calling this???

GA> It seems to crash roughly half the time with one of the above
GA> stack traces, so I'm guessing it's a threading problem in the
GA> Batik library; 

    There are no Batik threads shown in those stack traces.  Note that
the SVGGen class is _not_ thread safe and for performance and
complexity reasons probably never will be.

GA> my code is single-threaded.  

    Is the code calling your code single-threaded?  Just because _you_
don't create threads doesn't mean you aren't be invoked from multiple
threads (such as the event thread, and the application main thread for
a swing application, as a servelet you may be invoked from a
different thread for every server request).  If you are using a
non-thread safe object in such circumstances it is up to you to use
mutex blocks to protect all your accesses to the shared unthread safe
resource.

GA> I was able to fix it with the following patch.  

    It appears that this patch is attempting to make the SVGGen
classes at least partially thread safe.  This is essentially a
hopeless cause (as the entire DOM tree implementation would have to be
made thread safe to really solve the problem).

GA> I'm not on the batik-dev mailing list, so please Cc me with any
GA> replies to this message.  (I am on batik-users.)

    I strongly suspect that your code is being called from multiple
threads, and those multiple threads are then accessing a shared
instance of SVGGen, this will not work.

GA> Thanks.

    I don't think this is the answer you are looking for but I hope it
helps anyway.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to