Invalid ejbCreate% Definitions in Session-Beans

This query determines all the ejbCreate% methods of a session-bean that do not follow the specification rules.

Pre-packaged Query

Query name="Semmle/StyleChecks/J2EE/Session-Bean/Check ejbCreate%(..) methods' definition"

Reports all Session-Bean types that contain ejbCreate%(..) methods that are not public or that are final or static or that do not have return type void or that throw application exceptions.

from SessionBean sbean, Method m
where m.getName().matches("ejbCreate%") and
sbean.inherits(m) and
(not(m.hasModifier("public")) or
m.hasModifier("final") or
m.hasModifier("static") or
not(m.getType().hasName("void")) or
exists(Exception e | m.getAnException() = e and
e.getType().fromSource())) select sbean, sbean.toString() + " session-bean must define an ejbCreate%(..)" + " method that is public, not final, not static," + " has return type void and" + " does not throw application exceptions"

References

Enterprise JavaBeans 2.1 - Specification, section 7.11.3

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

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