The only thing I would add to this discussion is that if you can't duplicate
the problem, you can't fix it reliably. I tried everything I could think of
and didn't duplicate the problem. I haven't yet tried it with the same
exact Java version. We can't yet know if the problem is in JUMP code or in
Java itself.
Larry
On Wed, Dec 17, 2008 at 10:05 AM, Sunburned Surveyor <
sunburned.surve...@gmail.com> wrote:
> Paolo,
>
> I need to get into the cursor tool code and see how those two (2)
> different mouse events are being handled. I think we can safely tell
> the tool to not invoke the getShape method if the ArrayList of
> coordinates is empty. This would avoid the exception.
>
> If the getShape method is called with an empty ArrayList, we could
> simply flash a warning on the workbench to the user. If nothing else,
> this will tell us when the incorrect behavior is being triggered.
>
> SS
>
> On Wed, Dec 17, 2008 at 7:57 AM, P.Rizzi Ag.Mobilità Ambiente
> <paolo.ri...@ama-mi.it> wrote:
> > I'm happy to be helpful!!! :-)
> >
> > But remember that the check on coordinates.size() avoids the exception,
> > but it doesn't solve the problem.
> > Someway it has to be ensured that each coordinate is added to the array
> > before it is used.
> > I don't know how to ensure this...???
> >
> > Even if both methods were activated on the same mouse event (both
> > mouseReleased or both mouseClick), I don't know if it's possible
> > to garantee a certain invocation order.
> >
> > But it seems like a common problem, so with a little searching on the
> Web,
> > a simple solution is likely to show up.
> >
> > Bye
> > Paolo Rizzi
> >
> >
> >> -----Messaggio originale-----
> >> Da: Sunburned Surveyor [mailto:sunburned.surve...@gmail.com]
> >> Inviato: mercoledì 17 dicembre 2008 16.32
> >> A: OpenJump develop and use
> >> Oggetto: Re: [JPP-Devel] R: IndexOutOfBoundsExceptions with Java
> >> 1.6.0_11
> >>
> >>
> >> Paolo,
> >>
> >> That was some good debugging. :] I'm constantly reminded of how much I
> >> need to learn about Java. Based on the information you gave me, I
> >> think I can patch the code.
> >>
> >> I'm not sure why this problem is just now showing up.
> >>
> >> Maybe the other programms have some ideas.
> >>
> >> I will work on a fix today, and will post it to the list for others to
> >> review when complete.
> >>
> >> Landon
> >>
> >> On Wed, Dec 17, 2008 at 2:45 AM, P.Rizzi Ag.Mobilità Ambiente
> >> <paolo.ri...@ama-mi.it> wrote:
> >> > I didn't debugged the code, but the exception says:
> >> > java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> >> >
> >> > so it seems that the "coordinates" ArrayList is empty when
> >> > trying to access it's first element in:
> >> > coordinates.get(0);
> >> >
> >> > Defensive programming would suggest something like:
> >> > if( coordinates.size() < 1 )
> >> > return;
> >> >
> >> > as the first instruction of the function.
> >> > But the question is why the array is empty???
> >> >
> >> > The exception seems to stem from:
> >> > java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
> >> >
> >> > so it's a mouse released event, generated as soon as the
> >> mouse button
> >> > is depressed.
> >> >
> >> > Problem may be the tools accumulates coordinates using a
> >> mouseClick event,
> >> > that it's generated, I think, only after the mouseReleased event.
> >> > If this is the problem, though, I wonder why it didn't
> >> manifest itself before...???
> >> >
> >> >
> >> > Bye
> >> > Paolo Rizzi
> >> >
> >> >
> >> >> -----Messaggio originale-----
> >> >> Da: Sunburned Surveyor [mailto:sunburned.surve...@gmail.com]
> >> >> Inviato: martedì 16 dicembre 2008 1.39
> >> >> A: OpenJump develop and use
> >> >> Oggetto: Re: [JPP-Devel] IndexOutOfBoundsExceptions with
> >> Java 1.6.0_11
> >> >>
> >> >>
> >> >> I wanted to paste the code from the MultiClick tool's
> >> getShape method
> >> >> in case others catch something that I am missing:
> >> >>
> >> >> protected Shape getShape() throws
> >> NoninvertibleTransformException
> >> >> {
> >> >> Point2D firstPoint =
> >> >>
> >> getPanel().getViewport().toViewPoint((Coordinate)coordinates.get(0));
> >> >> GeneralPath path = new GeneralPath();
> >> >> path.moveTo((float) firstPoint.getX(), (float)
> >> >> firstPoint.getY());
> >> >>
> >> >> for (int i = 1; i < coordinates.size(); i++) {
> >> >> //start 1 [Jon Aquino]
> >> >>
> >> >> Coordinate nextCoordinate = (Coordinate)
> >> >> coordinates.get(i);
> >> >> Point2D nextPoint =
> >> >> getPanel().getViewport().toViewPoint(nextCoordinate);
> >> >> path.lineTo((int) nextPoint.getX(), (int)
> >> >> nextPoint.getY());
> >> >> }
> >> >> Point2D tentativePoint =
> >> >> getPanel().getViewport().toViewPoint(tentativeCoordinate);
> >> >> path.lineTo((int) tentativePoint.getX(), (int)
> >> >> tentativePoint.getY());
> >> >> // close path (for rings only)
> >> >> if (closeRing)
> >> >> path.lineTo((int) firstPoint.getX(), (int)
> >> >> firstPoint.getY());
> >> >>
> >> >> return path;
> >> >> }
> >> >>
> >> >> SS
> >> >>
> >> >> On Mon, Dec 15, 2008 at 4:38 PM, Sunburned Surveyor
> >> >> <sunburned.surve...@gmail.com> wrote:
> >> >> > OK. I took a look at the source code for Jukka's bug. I'm not
> >> >> > immediately seeing any problems. The MultiClick cursor tool
> >> >> stores its
> >> >> > coordinates in an ArrayList, which are then accessed in
> >> the getShape
> >> >> > method of the class. This is the method throwing the
> >> >> > IndexOutOfBoundsException.
> >> >> >
> >> >> > Jukka said in his original message: "Errors do not harm
> >> working, and
> >> >> > the message is like this..." I also noted that the Index and Size
> >> >> > parameters of the Exception were both zero. That makes
> >> me think that
> >> >> > maybe the getShape method is being called before the
> >> user has added
> >> >> > any clicks.
> >> >> >
> >> >> > However, this sounds like a JUMP bug, not a problem
> >> caused by a Java
> >> >> > update. So maybe the update is coincedental?
> >> >> >
> >> >> > At any rate, I'm sort of scratching my head at this point,
> >> >> and hoping
> >> >> > some of our other programmers might have suggestions on
> >> what to do
> >> >> > next. I'll download the nightly build and see if I can duplicate
> >> >> > Jukka's exception.
> >> >> >
> >> >> > Jukka,
> >> >> >
> >> >> > What version of OJ is producing the error?
> >> >> >
> >> >> > SS
> >> >> >
> >> >> > On Mon, Dec 15, 2008 at 11:41 AM, Sunburned Surveyor
> >> >> > <sunburned.surve...@gmail.com> wrote:
> >> >> >> Sorry Jukka...I missed the version in the subject line of
> >> >> the e-mail.
> >> >> >> Let me do some poking around this week and I will get back
> >> >> to you. If
> >> >> >> you don't hear from me by Friday, send me a reminder. :]
> >> >> >>
> >> >> >> SS
> >> >> >>
> >> >> >> On Mon, Dec 15, 2008 at 10:46 AM, Rahkonen Jukka
> >> >> >> <jukka.rahko...@mmmtike.fi> wrote:
> >> >> >>> Hi,
> >> >> >>>
> >> >> >>> I was drawing polylines, and the Java version number was
> >> >> hidden in the title :)
> >> >> >>>
> >> >> >>> -Jukka-
> >> >> >>>
> >> >> >>>
> >> >> >>> -----Alkuperäinen viesti-----
> >> >> >>> Lähettäjä: Sunburned Surveyor
> >> >> [mailto:sunburned.surve...@gmail.com]
> >> >> >>> Lähetetty: ma 15.12.2008 20:30
> >> >> >>> Vastaanottaja: OpenJump develop and use
> >> >> >>> Aihe: Re: [JPP-Devel] IndexOutOfBoundsExceptions with
> >> >> Java 1.6.0_11
> >> >> >>>
> >> >> >>> Jukka,
> >> >> >>>
> >> >> >>> Based on the stack trace you posted, this error is coming
> >> >> from the use
> >> >> >>> of a CursorTool. In particular, this cursor tool uses
> >> >> multiple clicks
> >> >> >>> on the Layer View to perform its work. The tool that
> >> >> allows a user to
> >> >> >>> draw a polygon is an example.
> >> >> >>>
> >> >> >>> I'm guessing the source of the problem may have to do with some
> >> >> >>> modifications to the java.util.Array class.
> >> >> >>>
> >> >> >>> You mentioned a Java update, but not the version of
> >> Java. Are you
> >> >> >>> running Java 1.5 or Java 1.6? What is your operating
> >> system? What
> >> >> >>> version of OpenJUMP, and can you provide any more
> >> details on the
> >> >> >>> update (like a date or version number)?
> >> >> >>>
> >> >> >>> Thanks,
> >> >> >>>
> >> >> >>> The Sunburned Surveyor
> >> >> >>>
> >> >> >>> On Mon, Dec 15, 2008 at 9:53 AM, Rahkonen Jukka
> >> >> >>> <jukka.rahko...@mmmtike.fi> wrote:
> >> >> >>>> Hi,
> >> >> >>>>
> >> >> >>>> Hi installed Java update and after that I have been
> >> >> getting every now and then IndexOutOfBoundsExceptions. I
> >> >> wonder if it is just an accident. I do not remember I have
> >> >> seen such errors before, even the work I was doing was just
> >> >> the same as always. Errors do not harm working, and the
> >> >> message is like this:
> >> >> >>>>
> >> >> >>>> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> >> >> >>>> at java.util.ArrayList.RangeCheck(Unknown Source)
> >> >> >>>> at java.util.ArrayList.get(Unknown Source)
> >> >> >>>> at
> >> >> com.vividsolutions.jump.workbench.ui.cursortool.MultiClickTool
> >> >> .getShape(MultiClickTool.java:206)
> >> >> >>>> at
> >> >> com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursor
> >> >> Tool.drawShapeXOR(AbstractCursorTool.java:353)
> >> >> >>>> at
> >> >> com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursor
> >> >> Tool.redrawShape(AbstractCursorTool.java:405)
> >> >> >>>> at
> >> >> com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursor
> >> >> Tool.redrawShape(AbstractCursorTool.java:378)
> >> >> >>>> at
> >> >> com.vividsolutions.jump.workbench.ui.cursortool.MultiClickTool
> >> >> .mouseReleased(MultiClickTool.java:133)
> >> >> >>>> at
> >> >> com.vividsolutions.jump.workbench.ui.cursortool.DelegatingTool
> >> >> .mouseReleased(DelegatingTool.java:116)
> >> >> >>>> at
> >> >> com.vividsolutions.jump.workbench.ui.cursortool.LeftClickFilte
> >> >> r.mouseReleased(LeftClickFilter.java:93)
> >> >> >>>> at
> >> >> com.vividsolutions.jump.workbench.ui.cursortool.DelegatingTool
> >> >> .mouseReleased(DelegatingTool.java:116)
> >> >> >>>> at
> >> >> com.vividsolutions.jump.workbench.ui.cursortool.QuasimodeTool.
> >> >> mouseReleased(QuasimodeTool.java:199)
> >> >> >>>> at
> >> >> java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
> >> >> >>>> at java.awt.Component.processMouseEvent(Unknown Source)
> >> >> >>>> at
> >> >> javax.swing.JComponent.processMouseEvent(Unknown Source)
> >> >> >>>> at java.awt.Component.processEvent(Unknown Source)
> >> >> >>>> at java.awt.Container.processEvent(Unknown Source)
> >> >> >>>> at java.awt.Component.dispatchEventImpl(Unknown Source)
> >> >> >>>> at java.awt.Container.dispatchEventImpl(Unknown Source)
> >> >> >>>> at java.awt.Component.dispatchEvent(Unknown Source)
> >> >> >>>> at
> >> >> java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
> >> >> >>>> at
> >> >> java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
> >> >> >>>> at
> >> >> java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
> >> >> >>>> at java.awt.Container.dispatchEventImpl(Unknown Source)
> >> >> >>>> at java.awt.Window.dispatchEventImpl(Unknown Source)
> >> >> >>>> at java.awt.Component.dispatchEvent(Unknown Source)
> >> >> >>>> at java.awt.EventQueue.dispatchEvent(Unknown Source)
> >> >> >>>> at
> >> >> java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
> >> >> >>>> at
> >> >> java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
> >> >> >>>> at
> >> >> java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> >> >> >>>> at
> >> java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> >> >> >>>> at
> >> java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> >> >> >>>> at java.awt.EventDispatchThread.run(Unknown Source)
> >> >> >>>>
> >> >> >>>> -Jukka Rahkonen-
> >> >> >>>>
> >> >> >>>>
> >> >> --------------------------------------------------------------
> >> >> ----------------
> >> >> >>>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in
> >> >> Las Vegas, Nevada.
> >> >> >>>> The future of the web can't happen without you. Join us
> >> >> at MIX09 to help
> >> >> >>>> pave the way to the Next Web now. Learn more and register at
> >> >> >>>>
> >> >> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009
> >> >> .visitmix.com/
> >> >> >>>> _______________________________________________
> >> >> >>>> Jump-pilot-devel mailing list
> >> >> >>>> Jump-pilot-devel@lists.sourceforge.net
> >> >> >>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >> >> >>>>
> >> >> >>>
> >> >> >>>
> >> >> --------------------------------------------------------------
> >> >> ----------------
> >> >> >>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in
> >> >> Las Vegas, Nevada.
> >> >> >>> The future of the web can't happen without you. Join us
> >> >> at MIX09 to help
> >> >> >>> pave the way to the Next Web now. Learn more and register at
> >> >> >>>
> >> >> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009
> >> > .visitmix.com/
> >> >>>> _______________________________________________
> >> >>>> Jump-pilot-devel mailing list
> >> >>>> Jump-pilot-devel@lists.sourceforge.net
> >> >>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >> >>>>
> >> >>>>
> >> >>>>
> >> --------------------------------------------------------------
> >> ----------------
> >> >>>> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in
> >> Las Vegas, Nevada.
> >> >>>> The future of the web can't happen without you. Join us
> >> at MIX09 to help
> >> >>>> pave the way to the Next Web now. Learn more and register at
> >> >>>>
> >
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> >>>>> _______________________________________________
> >>>>> Jump-pilot-devel mailing list
> >>>>> Jump-pilot-devel@lists.sourceforge.net
> >>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>>>>
> >>>>
> >>>
> >>
> >>
> ------------------------------------------------------------------------------
> >> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
> Nevada.
> >> The future of the web can't happen without you. Join us at MIX09 to
> help
> >> pave the way to the Next Web now. Learn more and register at
> >>
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> >> _______________________________________________
> >> Jump-pilot-devel mailing list
> >> Jump-pilot-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>
> >>
> ------------------------------------------------------------------------------
> >> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
> Nevada.
> >> The future of the web can't happen without you. Join us at MIX09 to
> help
> >> pave the way to the Next Web now. Learn more and register at
> >>
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> >> _______________________________________________
> >> Jump-pilot-devel mailing list
> >> Jump-pilot-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >>
> >
> >
> ------------------------------------------------------------------------------
> > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
> Nevada.
> > The future of the web can't happen without you. Join us at MIX09 to help
> > pave the way to the Next Web now. Learn more and register at
> >
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> > _______________________________________________
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
> >
> ------------------------------------------------------------------------------
> > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
> Nevada.
> > The future of the web can't happen without you. Join us at MIX09 to help
> > pave the way to the Next Web now. Learn more and register at
> >
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> > _______________________________________________
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
>
>
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
> The future of the web can't happen without you. Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
>
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
--
http://amusingprogrammer.blogspot.com/
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel