|
Re: OT: Bad examples everywhere (Was: distinguishing between failures and : msg#00140java.junit.user
I also love log4j, but when someone doesn't get it, he doesn't ! :) I found too many occurences of : log.error("Something bad happened here" + ex.getMessage()); in packages coded by "professionals". log4j doesn't entirelly gards you from being clueless. ;) mathieu ----- Original Message ----- From: Eric Heikkila To: junit@xxxxxxxxxxxxxxx Sent: Wednesday, June 19, 2002 7:54 PM Subject: Re: [junit] OT: Bad examples everywhere (Was: distinguishing between failures and errors) Hmm..that's one reason I've fallen in love with Log4J. Doing something like: catch (Exception ex) { log.error("Something bad happened here", ex) } is just a nice thing to have. Your own error message AND the exception message AND the stack trace. -Eric --- Mathieu Gervais <egoine_@xxxxxxxxxxx> wrote: > From: neil_swingler > >o Do nothing > >o Print/log message (but not the stacktrace) > >o Wrap the exception but lose the cause exception > and it's stacktrace > >o catch Exception (also catches all those > RuntimeExceptions they had > forgotten about > > ..and then you end up being the one trying to debug > this with absolutely no > information since they've thrown the root cause and > the stack trace. Arghhh. > > I'll add one to your list : > o Print/log message (but with neither the stacktrace > & the exception > classname : only the getMessage()) > > I think this comes from the fact that most sample > code (book examples, > tutorial, etc..) that are read by people learning > java include code like > this : > > try { > //something > } catch{Exception e) { > System.out.println("something bad happened + > e.getMessage(); > } > > Then all you get is : > "something bad happened 4" > > People are learning from examples and there aren't > that many simple but good > & completes examples out there. > > Every JDBC example uses string concatenation to > build the SQL (instead of > prepared statements) and then people wonder why the > industry has a security > problem with SQL injection! > > I just felt like saying it all! :) > > mathieu > __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com To unsubscribe from this group, send an email to: junit-unsubscribe@xxxxxxxxxxxxxxx Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | testing web application (jsp) with JavaScript, Vladimir Bilyov |
|---|---|
| Next by Date: | Re: testing web application (jsp) with JavaScript, Kirill Maximov |
| Previous by Thread: | Re: OT: Bad examples everywhere (Was: distinguishing between failures and errors), Jason Rogers |
| Next by Thread: | Re: distinguishing between failures and errors, Mike Clark |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |