So your solution is blame the user for a Java bug?

On Thu, Dec 18, 2008 at 9:59 AM, Sunburned Surveyor <
sunburned.surve...@gmail.com> wrote:

> Larry wrote: "I don't think we need a workaround, do we?"
>
> I think this bug pointed out a lack of robustness (or fragility) in
> the MultiClickTool class. I looked at the tool this morning, and I
> think I have an easy fix that will handle this error condition
> gracefully. It will also handle other similar error conditions more
> gracefully.
>
> Here is the fix:
>
> I modified the getShape method in the MultiClickTool class to throw an
> IllegalStateException with a unique message if the getShape method is
> called and the user has not made any clicks (the coordinates ArrayList
> is empty). I then throw this exception from the method.
>
> The getShape method is called by the drawShapeXOR method in the
> AbstractCursorTool class. I wrapped the implementation of this methon
> in a try/catch block. In the catch part of the block I snag any
> IllegalStateExceptions that are thrown. If the message of the
> Exception matches the one thrown from the getShape method of the
> MultiClickTool I get the WorkbenchFrame and warn the user that they
> need to click on the layer view more than twice before attempting to
> draw the shape.
>
> This may not be a perfect fit, but it is certainly better than getting
> a stack trace with an exception from an ArrayList burried deep in the
> code. If the fix is implemented we will, at a minimum:
>
> - Know that the problem really has to do with an illegal state in the
> cursor tool (no clicks in the coordinate list).
> - Be able to give the user some reasonable feedback.
> - Will be able to easily catch other IllegalStateExceptions caused by
> AbstractCursorTool extensions in the future and respond to them if
> appropriate.
>
> I tried to move the implementation of the drawShapeXOR method with my
> exception handling directly to the MultiClickTool class, but that
> causes other problems, since the majority of the classes "meat" is in
> the AbstractCursorTool class. If there are other ways to improve my
> fix, I'd like to hear about them.
>
> Any comments? Any objections to my commiting the fix if there is no
> concerns?
>
> SS
>
> On Thu, Dec 18, 2008 at 6:52 AM, Larry Becker <becker.la...@gmail.com>
> wrote:
> > Hi Peppe,
> >
> > Your tests seem pretty definitive.  We should probably discourage the use
> of
> > Java 1.6 10 and 11, although they seem to do no real harm.
> >
> > Looks like there were a ton of changes in _10:
> > http://java.sun.com/javase/6/webnotes/6u10.html
> >
> > The only remaining issue I see is determining if this (Windows?) Java bug
> > has been reported.  I don't think we need a workaround, do we?
> >
> > Larry
> >
> > On Thu, Dec 18, 2008 at 6:44 AM, Giuseppe Aruta <giuseppe_ar...@yahoo.it
> >
> > wrote:
> >>
> >> Hi all,
> >>
> >> I did some tests, following the information of Jukka
> >>
> >> - 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 (the error)!
> >>
> >> I tried using
> >> -JRE 1.5.0_12
> >> -JRE 1.6.0_07
> >> -JRE 1.6.o_10
> >> -JRE 1.6.0_11
> >>
> >> And two version of the softwrare
> >> -OpenJUMP 1.2F (stable realize - zip version)
> >> -openjump-core-1.2-20081218-bin (nigtly build)
> >>
> >> Windows XP SP3
> >> ADM Athlon(TM) XP 1800+
> >> 1.53 Mhz 469 Mb
> >>
> >> --------------------------------------------
> >> The Test
> >>
> >> OpenJUMP 1.2F (stable realize)
> >>
> >> -JRE 1.5.0_12 OK
> >> -JRE 1.6.0_07 OK
> >> -JRE 1.6.o_10 ERROR
> >> -JRE 1.6.0_11 ERROR
> >>
> >> Openjump-1.2-20081218 (nigtly build)
> >>
> >> -JRE 1.5.0_12 OK
> >> -JRE 1.6.0_07 OK
> >> -JRE 1.6.o_10 ERROR
> >> -JRE 1.6.0_11 ERROR
> >> _____________________________________
> >>
> >> With this test I can exclude that the problem can be  connected to
> >> something changed in OpenJUMP from ver F to actual one.
> >> And the problem got birth from jre1.6.0_07 to jre1.6.0_10 version, which
> >> probabily you know, but now empirically argued
> >>
> >> Regards
> >>
> >> Peppe
> >>
> >>
> >>
> >>
> >> --- Mer 17/12/08, Rahkonen Jukka <jukka.rahko...@mmmtike.fi> ha
> scritto:
> >>
> >> > Da: Rahkonen Jukka <jukka.rahko...@mmmtike.fi>
> >> > Oggetto: Re: [JPP-Devel] R: R: IndexOutOfBoundsExceptions with Java
> >> > 1.6.0_11
> >> > A: "OpenJump develop and use" <jump-pilot-devel@lists.sourceforge.net
> >,
> >> > "OpenJump develop and use" <jump-pilot-devel@lists.sourceforge.net>
> >> > Data: Mercoledì 17 dicembre 2008, 20:25
> >> > 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
> >>
> >>
> >>
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> 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
>



-- 
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

Reply via email to