• 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

Weblogic 6.0 EJBC and checked exceptions

 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone explain to me what's going on here?
public ResponsePK ejbFindByPrimaryKey(int id) throws javax.ejb.FinderException {
try {
loadUsingId(id);
} catch (EJBException fe) {
throw new EJBException(fe);
}
return pk;
}

private void loadUsingId(int id) {
try{
..... }catch (Exception e)
}
Why does this compile? The loadUsingId never throws a FinderException (which is a subclass of Exception) yet the ejbFindByPrimaryKey is permitted to declare that it throws a FinderException when one can never be thrown! Is this a compiler error or am I missing something??
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This is working just because javax.ejb.EJBException inherits java.lang.RuntimeException.
The BEA's EJB compiler isn't currently checking for RuntimeException based objects being thrown.
Well, this is just a loop hole in the J2EE specification, which doesn't mandate EJB Container implementations to check for RuntimeException.
 
reply
    Bookmark Topic Watch Topic
  • New Topic