• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception catching

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic