Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11
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,
Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11
This is a good point Larry. What I could do is give Paolo a build to try out. Then at least we can know if we've eliminated the problem for him. It is also possible that the existing code lacks some robustness. I see no reason why the getShape method of this particular cursor tool should be called with an empty list of coordinates. So perhaps we could improve the error checking here. At a minimum, it may be better to throw an IllegalStateException with an error message specific to the problem at hand which wraps the exception coming from the ArrayList. This is probably something that could be addressed in the parent class, the MulitClickTool. But I shouldn't say anymore until I look closer at the code, or I am liable to make an arse out of myself. Thanks again for your input. Landon On Wed, Dec 17, 2008 at 8:55 AM, Larry Becker becker.la...@gmail.com wrote: 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
Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11
I think you need to give Jukka the code, not Paolo :) stefan Sunburned Surveyor wrote: This is a good point Larry. What I could do is give Paolo a build to try out. Then at least we can know if we've eliminated the problem for him. It is also possible that the existing code lacks some robustness. I see no reason why the getShape method of this particular cursor tool should be called with an empty list of coordinates. So perhaps we could improve the error checking here. At a minimum, it may be better to throw an IllegalStateException with an error message specific to the problem at hand which wraps the exception coming from the ArrayList. This is probably something that could be addressed in the parent class, the MulitClickTool. But I shouldn't say anymore until I look closer at the code, or I am liable to make an arse out of myself. Thanks again for your input. Landon -- 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
Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11
Yes, and I doubt that even Jukka can reliably reproduce the problem. I've actually gotten array out of bounds exceptions myself using SkyJUMP, but it was always when I was doing actual GIS work and I didn't take the time to record the exception. It never seems to happen during testing. :-( Larry On Wed, Dec 17, 2008 at 12:01 PM, Stefan Steiniger sst...@geo.uzh.chwrote: I think you need to give Jukka the code, not Paolo :) stefan Sunburned Surveyor wrote: This is a good point Larry. What I could do is give Paolo a build to try out. Then at least we can know if we've eliminated the problem for him. It is also possible that the existing code lacks some robustness. I see no reason why the getShape method of this particular cursor tool should be called with an empty list of coordinates. So perhaps we could improve the error checking here. At a minimum, it may be better to throw an IllegalStateException with an error message specific to the problem at hand which wraps the exception coming from the ArrayList. This is probably something that could be addressed in the parent class, the MulitClickTool. But I shouldn't say anymore until I look closer at the code, or I am liable to make an arse out of myself. Thanks again for your input. Landon -- 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
Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11
Thanks guys. I geuss I got Jukka and Paolo mixed up. SS On Wed, Dec 17, 2008 at 10:52 AM, Larry Becker becker.la...@gmail.com wrote: Yes, and I doubt that even Jukka can reliably reproduce the problem. I've actually gotten array out of bounds exceptions myself using SkyJUMP, but it was always when I was doing actual GIS work and I didn't take the time to record the exception. It never seems to happen during testing. :-( Larry On Wed, Dec 17, 2008 at 12:01 PM, Stefan Steiniger sst...@geo.uzh.ch wrote: I think you need to give Jukka the code, not Paolo :) stefan Sunburned Surveyor wrote: This is a good point Larry. What I could do is give Paolo a build to try out. Then at least we can know if we've eliminated the problem for him. It is also possible that the existing code lacks some robustness. I see no reason why the getShape method of this particular cursor tool should be called with an empty list of coordinates. So perhaps we could improve the error checking here. At a minimum, it may be better to throw an IllegalStateException with an error message specific to the problem at hand which wraps the exception coming from the ArrayList. This is probably something that could be addressed in the parent class, the MulitClickTool. But I shouldn't say anymore until I look closer at the code, or I am liable to make an arse out of myself. Thanks again for your input. Landon -- 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 -- 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
Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11
Just right, Larry. I have been digitising for half an hour now trying to catch the error but with no luck. I would say this is not any serious bug. Even when it occurs no work gets lost. But hey! Right now I know how to reach the error. - select either draw polygon or draw linestring tool (basic, not the constrained ones) - RIGHT click on map and get the menu - LEFT click on map, and there it is! Perhaps this has nothing to do with Java update and happens only when doing real work in a hurry but have a try with other Java versions. -Jukka- -Alkuperäinen viesti- Lähettäjä: Larry Becker [mailto:becker.la...@gmail.com] Lähetetty: ke 17.12.2008 20:52 Vastaanottaja: OpenJump develop and use Aihe: Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11 Yes, and I doubt that even Jukka can reliably reproduce the problem. I've actually gotten array out of bounds exceptions myself using SkyJUMP, but it was always when I was doing actual GIS work and I didn't take the time to record the exception. It never seems to happen during testing. :-( Larry On Wed, Dec 17, 2008 at 12:01 PM, Stefan Steiniger sst...@geo.uzh.chwrote: I think you need to give Jukka the code, not Paolo :) stefan Sunburned Surveyor wrote: This is a good point Larry. What I could do is give Paolo a build to try out. Then at least we can know if we've eliminated the problem for him. It is also possible that the existing code lacks some robustness. I see no reason why the getShape method of this particular cursor tool should be called with an empty list of coordinates. So perhaps we could improve the error checking here. At a minimum, it may be better to throw an IllegalStateException with an error message specific to the problem at hand which wraps the exception coming from the ArrayList. This is probably something that could be addressed in the parent class, the MulitClickTool. But I shouldn't say anymore until I look closer at the code, or I am liable to make an arse out of myself. Thanks again for your input. Landon -- 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
[JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11
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
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
[JPP-Devel] R: IndexOutOfBoundsExceptions with Java 1.6.0_11
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.
Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11
Can't duplicate with jdk1.6.0_01 or jre1.5.0_12. Larry On Wed, Dec 17, 2008 at 1:25 PM, Rahkonen Jukka jukka.rahko...@mmmtike.fiwrote: Just right, Larry. I have been digitising for half an hour now trying to catch the error but with no luck. I would say this is not any serious bug. Even when it occurs no work gets lost. But hey! Right now I know how to reach the error. - select either draw polygon or draw linestring tool (basic, not the constrained ones) - RIGHT click on map and get the menu - LEFT click on map, and there it is! Perhaps this has nothing to do with Java update and happens only when doing real work in a hurry but have a try with other Java versions. -Jukka- -Alkuperäinen viesti- Lähettäjä: Larry Becker [mailto:becker.la...@gmail.com] Lähetetty: ke 17.12.2008 20:52 Vastaanottaja: OpenJump develop and use Aihe: Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11 Yes, and I doubt that even Jukka can reliably reproduce the problem. I've actually gotten array out of bounds exceptions myself using SkyJUMP, but it was always when I was doing actual GIS work and I didn't take the time to record the exception. It never seems to happen during testing. :-( Larry On Wed, Dec 17, 2008 at 12:01 PM, Stefan Steiniger sst...@geo.uzh.ch wrote: I think you need to give Jukka the code, not Paolo :) stefan Sunburned Surveyor wrote: This is a good point Larry. What I could do is give Paolo a build to try out. Then at least we can know if we've eliminated the problem for him. It is also possible that the existing code lacks some robustness. I see no reason why the getShape method of this particular cursor tool should be called with an empty list of coordinates. So perhaps we could improve the error checking here. At a minimum, it may be better to throw an IllegalStateException with an error message specific to the problem at hand which wraps the exception coming from the ArrayList. This is probably something that could be addressed in the parent class, the MulitClickTool. But I shouldn't say anymore until I look closer at the code, or I am liable to make an arse out of myself. Thanks again for your input. Landon -- 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 -- 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
Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11
Hi, It is rather well isolated now. I can't dublicate it with jre 1.6.0_07, but for sure with 1.6.0_11. -Jukka- -Alkuperäinen viesti- Lähettäjä: Larry Becker [mailto:becker.la...@gmail.com] Lähetetty: ke 17.12.2008 22:32 Vastaanottaja: OpenJump develop and use Aihe: Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11 Can't duplicate with jdk1.6.0_01 or jre1.5.0_12. Larry On Wed, Dec 17, 2008 at 1:25 PM, Rahkonen Jukka jukka.rahko...@mmmtike.fiwrote: Just right, Larry. I have been digitising for half an hour now trying to catch the error but with no luck. I would say this is not any serious bug. Even when it occurs no work gets lost. But hey! Right now I know how to reach the error. - select either draw polygon or draw linestring tool (basic, not the constrained ones) - RIGHT click on map and get the menu - LEFT click on map, and there it is! Perhaps this has nothing to do with Java update and happens only when doing real work in a hurry but have a try with other Java versions. -Jukka- -Alkuperäinen viesti- Lähettäjä: Larry Becker [mailto:becker.la...@gmail.com] Lähetetty: ke 17.12.2008 20:52 Vastaanottaja: OpenJump develop and use Aihe: Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11 Yes, and I doubt that even Jukka can reliably reproduce the problem. I've actually gotten array out of bounds exceptions myself using SkyJUMP, but it was always when I was doing actual GIS work and I didn't take the time to record the exception. It never seems to happen during testing. :-( Larry On Wed, Dec 17, 2008 at 12:01 PM, Stefan Steiniger sst...@geo.uzh.ch wrote: I think you need to give Jukka the code, not Paolo :) stefan Sunburned Surveyor wrote: This is a good point Larry. What I could do is give Paolo a build to try out. Then at least we can know if we've eliminated the problem for him. It is also possible that the existing code lacks some robustness. I see no reason why the getShape method of this particular cursor tool should be called with an empty list of coordinates. So perhaps we could improve the error checking here. At a minimum, it may be better to throw an IllegalStateException with an error message specific to the problem at hand which wraps the exception coming from the ArrayList. This is probably something that could be addressed in the parent class, the MulitClickTool. But I shouldn't say anymore until I look closer at the code, or I am liable to make an arse out of myself. Thanks again for your input. Landon -- 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 -- 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
Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11
Guess we need to look at the Java change logs for 1.6.0_11. Is anyone using a 1.6 before _11 and after _07? Larry On Wed, Dec 17, 2008 at 4:45 PM, Rahkonen Jukka jukka.rahko...@mmmtike.fiwrote: Hi, It is rather well isolated now. I can't dublicate it with jre 1.6.0_07, but for sure with 1.6.0_11. -Jukka- -Alkuperäinen viesti- Lähettäjä: Larry Becker [mailto:becker.la...@gmail.com] Lähetetty: ke 17.12.2008 22:32 Vastaanottaja: OpenJump develop and use Aihe: Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11 Can't duplicate with jdk1.6.0_01 or jre1.5.0_12. Larry On Wed, Dec 17, 2008 at 1:25 PM, Rahkonen Jukka jukka.rahko...@mmmtike.fiwrote: Just right, Larry. I have been digitising for half an hour now trying to catch the error but with no luck. I would say this is not any serious bug. Even when it occurs no work gets lost. But hey! Right now I know how to reach the error. - select either draw polygon or draw linestring tool (basic, not the constrained ones) - RIGHT click on map and get the menu - LEFT click on map, and there it is! Perhaps this has nothing to do with Java update and happens only when doing real work in a hurry but have a try with other Java versions. -Jukka- -Alkuperäinen viesti- Lähettäjä: Larry Becker [mailto:becker.la...@gmail.com] Lähetetty: ke 17.12.2008 20:52 Vastaanottaja: OpenJump develop and use Aihe: Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java 1.6.0_11 Yes, and I doubt that even Jukka can reliably reproduce the problem. I've actually gotten array out of bounds exceptions myself using SkyJUMP, but it was always when I was doing actual GIS work and I didn't take the time to record the exception. It never seems to happen during testing. :-( Larry On Wed, Dec 17, 2008 at 12:01 PM, Stefan Steiniger sst...@geo.uzh.ch wrote: I think you need to give Jukka the code, not Paolo :) stefan Sunburned Surveyor wrote: This is a good point Larry. What I could do is give Paolo a build to try out. Then at least we can know if we've eliminated the problem for him. It is also possible that the existing code lacks some robustness. I see no reason why the getShape method of this particular cursor tool should be called with an empty list of coordinates. So perhaps we could improve the error checking here. At a minimum, it may be better to throw an IllegalStateException with an error message specific to the problem at hand which wraps the exception coming from the ArrayList. This is probably something that could be addressed in the parent class, the MulitClickTool. But I shouldn't say anymore until I look closer at the code, or I am liable to make an arse out of myself. Thanks again for your input. Landon -- 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 -- 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 -- 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