{
ApplicationExceptionEffigy appEx = effigy.getApplicationException(exceptionType);
if(appEx != null)
{
if(appEx.isInherited() || appEx.getExceptionClass().equals(exceptionType))
return new ApplicationExceptionImpl(appEx.isRollback());
else
return null;
}
// Everything after this line is a hack.
// TODO: we have no facility that picks up annotations from shared libs, so lets do some emergency annotation scanning.
ApplicationException annotation = exceptionType.getAnnotation(ApplicationException.class);
if(annotation != null)
return annotation;
// An unchecked-exception is only an application exception if annotated (or described) as such.
// (see EJB 3.1 FR 14.2.1)
if (RuntimeException.class.isAssignableFrom(exceptionType) || Error.class.isAssignableFrom(exceptionType))
return null;
// This feels like a hack around shortcomings in jboss-metadata
Class[] exceptionTypes = invokedMethod.getExceptionTypes();
for (Class exceptionClass : exceptionTypes)
{
if (exceptionClass.isAssignableFrom(exceptionType))
return new ApplicationExceptionImpl(false);
}
return null;
}