From: Matthieu C. <cho...@gm...> - 2012-01-27 08:01:50
|
So it is blocking when you use it from the console. Ok I understand. I suppose instead having that catch in the loop, the catch could be outside, so after catching the exception the method would return. 2012/1/27 Alan Ezust <ala...@gm...> > Using it from Console causes an interruptedException at object.wait(). > There is definitely something wrong with that line. > the Log.log() should be passing the exception object as the 4th argument, > instead of the 3rd in any case. > Testing my own copy with that suggested change... > > > > On Thu, Jan 26, 2012 at 3:42 PM, Matthieu Casanova <cho...@gm... > > wrote: > >> Maybe that method could rethrow the exception, but I don't think calling >> interrupt on the current thread is a good idea. >> You don't know what thread will call that method and have no idea of the >> effects. >> Did you had any problems with that method ? >> >> >> 2012/1/26 Jarekczek <jar...@po...> >> >>> Quote: >>> The worst thing you can do with InterruptedException is swallow it -- >>> catch >>> it and neither rethrow it nor reassert the thread's interrupted status. >>> The >>> standard approach to dealing with an exception you didn't plan for -- >>> catch >>> it and log it -- also counts as swallowing the interruption because code >>> higher up on the call stack won't be able to find out about it. (Logging >>> InterruptedException is also just silly because by the time a human reads >>> the log, it is too late to do anything about it.) >>> >>> So what jedit does is many places is wrong. We should aim at correcting >>> the >>> wrong behaviour. Whole article is here: >>> http://www.ibm.com/developerworks/java/library/j-jtp05236/index.html >>> >>> The simplest approach instead of Log() is >>> Thread.currentThread().interrupt() >>> and go on. This is a solution without rethrowing the exception which is >>> the >>> other acceptable option. >>> >>> The first to be corrected is the >>> ThreadUtilities.runInDispatchThreadAndWait() method. >>> >>> Jarek >>> >>> -- >>> View this message in context: >>> http://jedit.9.n6.nabble.com/interruption-handling-in-jedit-tp4341845p4341845.html >>> Sent from the jedit-devel mailing list archive at Nabble.com. >>> >>> >>> ------------------------------------------------------------------------------ >>> Keep Your Developer Skills Current with LearnDevNow! >>> The most comprehensive online learning library for Microsoft developers >>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, >>> Metro Style Apps, more. Free future releases when you subscribe now! >>> http://p.sf.net/sfu/learndevnow-d2d >>> -- >>> ----------------------------------------------- >>> jEdit Developers' List >>> jEd...@li... >>> https://lists.sourceforge.net/lists/listinfo/jedit-devel >>> >> >> >> >> ------------------------------------------------------------------------------ >> Keep Your Developer Skills Current with LearnDevNow! >> The most comprehensive online learning library for Microsoft developers >> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, >> Metro Style Apps, more. Free future releases when you subscribe now! >> http://p.sf.net/sfu/learndevnow-d2d >> -- >> ----------------------------------------------- >> jEdit Developers' List >> jEd...@li... >> https://lists.sourceforge.net/lists/listinfo/jedit-devel >> >> > |