• Post Reply Bookmark Topic Watch Topic
  • New Topic

not catching Parent Exception  RSS feed

 
Ranch Hand
Posts: 1489
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it good practice to catch all child exceptions except parent exception
Exception
.


try {

} catch(NullPointerException ne) {

} catch(ArrayIndexOutOfBoundsException ae) {

}
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it good practice to catch all child exceptions except parent exception

Not really. If you catch a NullPointerException, what are you going to do with it ?
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agree; a NullPointerException and an IndexOutOfBoundsException should be corrected by finding the error in the code
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!