• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception catching  RSS feed

 
venu kumar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my question.
1)In my EJB, i am catching DuplicatePlanException and i am wrapping it in EJB exception and throwing it.
2) In delegate class, i am catching this exception as RemoteException and wrapping it in FatalException and throwing it.
3) When i come to my action class, how can i catch DuplicatePlanException.

Pls respond, as it is very urgent

Thanks in advance.
bye
venu
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is DuplicatePlanException a system exception? If so, you can just duck this exception. The container will handle it because it is a RuntimeException and send RemoteException to the client. In your Delegate, see if you can extract the nested exception by invoking getCause() on RemoteException and casting the return value to DuplicatePlanException. If there could be more than one type of nested exception, then use instanceof instead.

If the return value is null, then the container will have failed to encapsulate DuplicatePlanException in RemoteException, so we would have to rethink this.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!