Hi Mike,

Mike Haladin <[EMAIL PROTECTED]> wrote on 08/14/2006 06:38:51 AM:

> I am trying to gernerate a game map of many rectangles on a java 
servlet. 
> Without pattern, it seems that 3 or 4 random rectangles always throw an 
java.
> lang.ArrayIndexOutOfBoundsException.
> 
> This occurs everytime I draw my map and slows the generation down 
considerably.
> 
> I have tried my best (via synchronization) to make the request single 
threaded
> as to eliminate possible threading issues, however this did not help.
> 
> Any help would be greatly appreciated.

   It looks to me like you have gotten in pretty deep with the
SVGGraphics2D.  The code that appears to be throwing the exception is:

        int nManagers = groupManagers.size();
        for(int i=0; i<nManagers; i++){
            DOMGroupManager gm = 
(DOMGroupManager)groupManagers.elementAt(i);
            gm.recycleCurrentGroup();
        }

   As you can see the only way this code can generate an exception
in 'elementAt' is if the DOMGroupManager.recycleCurrentGroup call
removes elements from the groupManagers Vector in SVGGraphics2D, or
if another thread is mucking with the Graphics2D at the same time.
Since implementation in Batik does neither of these, I presume that you
may be subclassing this and in some case removing groups from the
Vector, or else you have not succeeded in synchronizing properly
(probably the latter).

   I would suggest getting the source to Batik and adding
logging when various critical methods are called (like 
'removeGroupManager', and 'recycleTopLevelGroup') so you
can see what the sequence of events is that causes the
problem.  I often find code like:
        new Exception("Foo happened").printStackTrace();

   While verbose is useful for seeing the context that caused
a method to be called.


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

Reply via email to