6 Replies Latest reply on Nov 23, 2007 4:52 AM by Carlo de Wolf

    Add @ApplicationException to EJBContainer?

    Andrew Rubinger Master

      Placed an ugly line in the other day:

      catch(Exception e)
      {
       if(e.getClass().getAnnotation(ApplicationException.class)!=null)
      {
       ...handle AppException
      } else {
       ...handle Exception as normal
      }


      This doesn't account for a couple things:

      1) XML-defined ApplicationExceptions in ejb-jar.xml assembly-descriptor/application-exceptions
      2) Inheritance (is an exception whose parent is @ApplicationException also an Application Exception?)

      Would propose adding a List of Application Exceptions to EJBContainer, which I think would entail:

      1) An additional method in Ejb3DescriptorHandler, "addApplicationExceptionAnnotations", to be called from addAssemblyAnnotations().
      2) Additional scanning for @ApplicationException at deployment time.

      Tricky thing here is that Application Exceptions are global per deployment unit (JAR), and would need to be referenced from all EJBs (Containers) in that unit.

      Or is the matadata project making some of this moot by merging the annotations and XML together into JBossAssemblyDescriptorMetaData, in which case we can skip the scanning step 2) above?

      S,
      ALR