FileDocCategorySizeDatePackage
LocalInterfaceRemoteException.javaAPI DocGlassfish v2 API4654Fri May 04 22:33:56 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.intf.localintf

LocalInterfaceRemoteException

public class LocalInterfaceRemoteException extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest
The throws clause of a home method on the local home interface may include additional application-level exceptions. It must not include the java.rmi.RemoteException.
author
Vikas Awasthi

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

        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        ClassLoader cl = getVerifierContext().getClassLoader();
        String localClassName = descriptor.getLocalHomeClassName();
        if (localClassName!=null) {
            try {
                Class localHome = Class.forName(localClassName, false, cl);
                Method[] methods = localHome.getMethods();
                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 a RemoteException.", 
                                new Object[]{methods[i]}));
                    }
                
                }
            } catch (ClassNotFoundException e) {
                Verifier.debug(e);
                addErrorDetails(result, compName);
                result.failed(smh.getLocalString
                                (getClass().getName()+".failed1",
                                "LocalHome class [ {0} ] not found.", 
                                new Object[]{localClassName}));
            }
        }

        if(result.getStatus() != Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                    (getClass().getName() + ".passed",
                            "Valid LocalInterface."));
        }
        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;