EJB Checks

Discussions

EJB programming & troubleshooting: EJB Checks

  1. EJB Checks (3 messages)

    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...

    String someBusinessMethod();

    Is there a way to check that the component interface and the bean class methods marry up?

    Threaded Messages (3)

  2. EJB Checks[ Go to top ]

    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.
  3. Exactly...[ Go to top ]

    Yes, I know :-) That's why I need to identify those, clean them up and ensure that they are never put there automatically.
  4. Exactly...[ Go to top ]

    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