FileDocCategorySizeDatePackage
RemoteExceptionNotThrown.javaAPI DocGlassfish v2 API4243Fri May 04 22:34:04 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.messagebean

RemoteExceptionNotThrown

public class RemoteExceptionNotThrown extends MessageBeanTest
Message listener methods should not throw java.rmi.RemoteException.
author
Vikas Awasthi

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbMessageBeanDescriptor descriptor)

        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        ClassLoader cl = getVerifierContext().getClassLoader();
        try {
            Method[] methods = descriptor.getMessageListenerInterfaceMethods(cl);
            for (int i = 0; i < methods.length; i++) {
                if(containsRemote(methods[i].getExceptionTypes())) {
                    addErrorDetails(result, compName);
                    result.failed(smh.getLocalString
                                    (getClass().getName()+".failed",
                                    "Method [ {0} ] throws RemoteException",
                                    new Object[] {methods[i]}));
                }
            }
        } catch (NoSuchMethodException e) {
            Verifier.debug(e);
            addErrorDetails(result, compName);
            result.failed(smh.getLocalString
                            (getClass().getName()+".failed1",
                            "[ {0} ]", new Object[]{e.getMessage()}));
        }
        
        if(result.getStatus() != Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                            (getClass().getName() + ".passed",
                            "Valid message listener method(s)."));
        }
        return result;
    
private booleancontainsRemote(java.lang.Class[] exceptions)
returns true if one of the exceptions is RemoteException

        for (int i = 0; i < exceptions.length; i++) 
            if(exceptions[i].getName().equals("java.rmi.RemoteException"))
                return true;
        
        return false;