• Post Reply Bookmark Topic Watch Topic
  • New Topic

wrong exception in JSP page

 
nuthan kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I have one JSP which is calling java class to perform some action. JSP page is not able to catch correct exception from the class.

Java class Code


JSP code


in jsp instead of displaying Array out of bound exception, its always displaying null pointer exception. I tried throwing custom exception from java class. still jsp is catching Null pointer exception.
 
Swastik Dey
Rancher
Posts: 1686
7
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be the NullPointerException is occurring before your custom exception is thrown.
 
suchit pandya
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Swastik and

is better option then


It will print the file and line number where error hs been accured. So you can track it easly.
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nuthan kumar wrote:
// array out of bound exception here


Don't catch array out of bounds exceptions, fix your code so that it is not thrown, check for array length, etc!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!