EJB programming & troubleshooting: EJB Checks
This'll probably sound stupid. But, is there a way to check that the component interface and the bean class method signatures match?
Some of the beans in our project declare subclasses of RuntimeException in their throws clause. Manually going through them and cleaning them up is tedious.
I can switch all my beans to use the BusinessInterface pattern. If I have a method like this in the interface
String someBusinessMethod() throws ContractExcetption
and ContractException is a RuntimeException, I don't get a compile error if the bean class has...
Is there a way to check that the component interface and the bean class methods marry up?
Why are your EJB remote interfaces declaring that they throw Runtime exceptions? A Runtime exception won't be transmitted to the client, so there is no reason in putting them in the interface's method declaration.
Yes, I know :-) That's why I need to identify those, clean them up and ensure that they are never put there automatically.
Ah! You need to *remove* the Runtime exceptions, not add them. That's easier. You could use the code parser trick I suggested on the remote interface (it's not hard, just count braces).
Or, you could write a Doclet to examine your classes and report Runtime exception declarations. That's the same as the code parser, but easier to write, because Javadoc does all the hard work.
Check out: http://java.sun.com/j2se/1.4.2/docs/tooldocs/javadoc/overview.html