public static final boolean throwsApplicationException(Method method, EnterpriseBean bean) { List exceptions = method.getJavaExceptions(); if(exceptions.size() == 0) { return false; } // CHKJ2419 = {0} must be a subclass of java.lang.Exception. Read section 18.1.1, 18.2.1 of the EJB 2.0 specification. Iterator iterator = exceptions.iterator(); while(iterator.hasNext()) { JavaClass exception = (JavaClass)iterator.next(); if(isApplicationException(exception, bean)) { return true; } } return false; }
List methToMatchExceptions = methodToMatch.getJavaExceptions(); List foundMethExceptions = method.getJavaExceptions(); for( int i = 0; i < foundMethExceptions.size(); i++ ) { JavaClass exc = (JavaClass)foundMethExceptions.get(i);
List methToMatchExceptions = methodToMatch.getJavaExceptions(); List foundMethExceptions = method.getJavaExceptions(); for( int i = 0; i < foundMethExceptions.size(); i++ ) { JavaClass exc = (JavaClass)foundMethExceptions.get(i);
/** * Return true if the given method throws the named exception or a class which extends the named exception. */ public static final boolean throwsException(EnterpriseBean bean, Method method, String exceptionName) throws InvalidInputException { if(method == null) { return false; } List exceptions = method.getJavaExceptions(); Iterator iterator = exceptions.iterator(); JavaClass exception = getType(exceptionName, bean).getWrapper(); while(iterator.hasNext()) { JavaClass exc = (JavaClass)iterator.next(); if(isAssignableFrom(exc, exception)) { return true; } } return false; }
/** * Return true if the method returns the named exception, an exception which extends the named exception, or one of the parents of the named exception (e.g. java.lang.Exception). * Use this method if it needs to be detected that an exception can be thrown either directly or through something generic like java.lang.Exception. */ public static final boolean throwsExceptionOrParent(EnterpriseBean bean, Method method, String exceptionName) throws InvalidInputException { if(method == null) { return false; } JavaClass exception = getType(exceptionName, bean).getWrapper(); List exceptions = method.getJavaExceptions(); Iterator iterator = exceptions.iterator(); while(iterator.hasNext()) { JavaClass exc = (JavaClass)iterator.next(); if(isAssignableFrom(exc, exception)) { // Assignable from the named exception, e.g. RemoteException or a child of RemoteException return true; } if(isAssignableFrom(exception, exc)) { // The named exception is assignable from the method exception, e.g. java.lang.Exception return true; } } return false; }
List exceptions = method.getJavaExceptions(); if (!exceptions.isEmpty()) w.write(" throws ");
public void validateApplicationExceptionRules(IEJBValidationContext vc, EnterpriseBean bean, JavaClass clazz, Method method) throws ValidationCancelledException { List exceptions = method.getJavaExceptions(); if(exceptions.size() == 0) { return;