Invalid find% Definitions in Local Home Interface |
This query determines all the find% methods of a local home interface that do not follow the specification rules.
Pre-packaged Query
Query name="Semmle/StyleChecks/J2EE/Local Home Interface/Check find%(..) methods' definition"
Reports all Local Home Interface types that contain find%(..) method definitions that have a return type void or do not throw an exception of type javax.ejb.FinderException.
from LocalEJBHomeInterface lhi, Method m
where m.getName().matches("find%") and lhi.inherits(m) and (m.getType().hasName("void") or not exists(Exception e | m.getAnException() = e and e.getType().hasQualifiedName("javax.ejb","FinderException")))
select m, m.toString() + " must not have return type void and"
+ " must throw an exception of type javax.ejb.FinderException"
References
Enterprise JavaBeans 2.1 - Specification, section
10.6.12 and 12.2.11
|