Toymods Car Club
www.toymods.org.au
F.A.Q. F.A.Q.    Register Register    Login Login    Home Home
Members Members    Search Search
Toymods » General Car Talk » hey java buffs

Show: Today's Posts  :: Show Polls 
Email to friend 
Return to the default flat view Create a new topic Submit Reply
AuthorTopic
SupraPete
Forums Junkie


Location:
Sydney
Registered:
July 2002
   
Re: hey java buffs Tue, 06 May 2003 07:46 Go to previous messageGo to previous message
Nark wrote on Tue, 06 May 2003 15:51

Depends on how everything is set up. Stuff like null pointers shouldn't create a stack trace if it's fixable.
I wouldn't put a try loop JUST to catch a NullPointerException, I'd just put the if blocks around it.
But sometimes you can fix it elegantly with a catch for null pointers. Like verify that the rest of the data is clean or even throw more exceptions for them to casade outward.
Really depends on your architecture.


Sorry I was a bit vage. I meant your IF statement was the right way to go (you are right, I'm not dissagreeing with you), but a specific try BLOCK (its a block not a bloody "loop"!! Mad ) for just a null pointer is silly. Which is exactly what you said in the quote.

As for elegant catches YUK. No such thing. A catch is ONLY if there is something that wasn't expected. If there is a possibility there is a null, test for it, don't expect the try block to pick it up. Putting more than e.printStackTrace() or throwing another exception within a catch block is disgusting code.


I didn't know there were this many java learners/programmers in Toymods Shocked Shocked . Just remember grasshopper(s):

Computers are a great way to make money. Money that can be spent on doing up toyotas!
  Send a private message to this user    

SubjectPosterDate
Read Message   hey java buffs RA28Mon, 05 May 2003 05:56
Read Message   Re: hey java buffs CoryMon, 05 May 2003 06:23
Read Message   Re: hey java buffs NarkMon, 05 May 2003 07:31
Read Message   Re: hey java buffs RA28Mon, 05 May 2003 11:14
Read Message   Re: hey java buffs NarkTue, 06 May 2003 03:02
Read Message   Re: hey java buffs ehendrikdTue, 06 May 2003 03:40
Read Message   Re: hey java buffs SupraPeteTue, 06 May 2003 03:48
Read Message   Re: hey java buffs ehendrikdTue, 06 May 2003 03:57
Read Message   Re: hey java buffs NarkTue, 06 May 2003 05:51
Read Message   Re: hey java buffs  SupraPeteTue, 06 May 2003 07:46
Read Message   Re: hey java buffs NarkTue, 06 May 2003 08:55
Read Message   Re: hey java buffs SupraPeteTue, 06 May 2003 09:59
Read Message   Re: hey java buffs CoryTue, 06 May 2003 07:01
Read Message   Re: hey java buffs SupraPeteTue, 06 May 2003 03:52
Read Message   Re: hey java buffs justcallmefrankTue, 06 May 2003 08:05
Read Message   Re: hey java buffs SupraPeteTue, 06 May 2003 08:11
Read Message   Re: hey java buffs justcallmefrankTue, 06 May 2003 08:12
Read Message   Re: hey java buffs RibboTue, 06 May 2003 08:16
Read Message   Re: hey java buffs justcallmefrankTue, 06 May 2003 08:19
Previous Topic:Sydney autosalon
Next Topic:broken again

Goto Forum:
-=] Back to Top [=-

Current Time: Wed Jun 26 19:57:16 UTC 2024

Total time taken to generate the page: 0.0042009353637695 seconds

Bandwidth utilization bar

.:: Contact :: Home ::.

Powered by: FUDforum 2.3.8
Copyright ©2001-2003 Advanced Internet Designs Inc.