• Post Reply Bookmark Topic Watch Topic
  • New Topic

Standard way to handle null getRequestDispatcher()?  RSS feed

 
Junilu Lacar
Sheriff
Posts: 11165
160
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there one? I am always defensive so I started writing:

Thanks,
Junilu
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have never thought of doing it that way Junilu, here is what I do for unexpected errors:It's a bit repetitive to put the servletName.methodName, since this is also in the stacktrace, but if I use errorPages, I can get a shorthand version by using getMessage()
 
Junilu Lacar
Sheriff
Posts: 11165
160
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Mike,
I asked our lead developer and he thinks that we shouldn't even bother with checking for null: just let the NullPointerException get thrown and bubble up to the enclosing servlet error handler. I was just curious to see if other teams might have some other "standard" strategy for handling the situation.
Junilu

[This message has been edited by JUNILU LACAR (edited December 01, 2001).]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!