1 23 package com.sun.enterprise.tools.verifier.tests.ejb.beanclass; 24 25 import java.lang.reflect.Modifier ; 26 import com.sun.enterprise.deployment.EjbDescriptor; 27 import com.sun.enterprise.tools.verifier.Result; 28 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest; 29 import com.sun.enterprise.tools.verifier.tests.*; 30 31 33 public class EjbClassModifiersFinal extends EjbTest { 34 35 41 public Result check(EjbDescriptor descriptor) { 42 43 Result result = getInitializedResult(); 44 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 45 46 Class c = loadEjbClass(descriptor, result); 47 if (c!=null) { 48 boolean isFinal = false; 49 int modifiers = c.getModifiers(); 50 if (Modifier.isFinal(modifiers)) { 51 isFinal = true; 52 } 53 54 if (!isFinal) { 55 result.addGoodDetails(smh.getLocalString 56 ("tests.componentNameConstructor", 57 "For [ {0} ]", 58 new Object [] {compName.toString()})); 59 result.passed(smh.getLocalString 60 (getClass().getName() + ".passed", 61 "[ {0} ] properly declares non-final class modifier.", 62 new Object [] {descriptor.getEjbClassName()})); 63 } else if (isFinal) { 64 result.addErrorDetails(smh.getLocalString 65 ("tests.componentNameConstructor", 66 "For [ {0} ]", 67 new Object [] {compName.toString()})); 68 result.failed(smh.getLocalString 69 (getClass().getName() + ".failed", 70 "Error: Ejb Class [ {0} ] was found, but was declared as final. The class [ {1} ] must not be defined as final.", 71 new Object [] {descriptor.getEjbClassName(),descriptor.getEjbClassName()})); 72 } 73 } 74 return result; 75 } 76 } 77 | Popular Tags |