Invalid ejbCreate% Definitions in Entity-Beans

This query finds all the ejbCreate% methods of an entity-bean, with container managed persistence, that do not follow the specification rules.

Pre-packaged Query

Query name="Semmle/StyleChecks/J2EE/Entity-Bean/with Container-Managed Persistence/Check ejbCreate%(..) methods' definition"

Reports all Entity-Bean types with container managed persistence that contain ejbCreate%(..) methods that do not throw an exception of type javax.ejb.CreateException.

from EntityBean ebean, Method m
where m.getName().matches("ejbCreate%") and
      ebean.inherits(m) and
      not exists(Exception e | m.getAnException() = e and
e.getType().hasQualifiedName("javax.ejb","CreateException")) select m, m.toString() + " must throw an exception" + " of type javax.ejb.CreateException"

References

Enterprise JavaBeans 2.1 - Specification, section 10.6.4

Digg!Reddit!Del.icio.us!Facebook!Slashdot!Technorati!StumbleUpon!Ma.gnolia!

Comments
Only registered users can write comments!
 
< Prev   Next >