1 23 24 package com.sun.enterprise.tools.verifier.tests.appclient; 25 26 import java.lang.reflect.Modifier ; 27 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor; 28 import com.sun.enterprise.tools.verifier.Result; 29 import com.sun.enterprise.deployment.ApplicationClientDescriptor; 30 31 37 public class AppClientMainClass extends AppClientTest implements AppClientCheck { 38 39 public Result check(ApplicationClientDescriptor descriptor) { 40 Result result = getInitializedResult(); 41 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 42 43 String mainClass = descriptor.getMainClassName(); 44 if (mainClass != null && mainClass.length() > 0) { 45 try { 46 Class c = Class.forName(mainClass, false, getVerifierContext().getClassLoader()); 47 if(!Modifier.isPublic(c.getModifiers())) { 48 addErrorDetails(result, compName); 49 result.failed(smh.getLocalString(getClass().getName() + ".failed2", 50 "ERROR: Appclient main-class [ {0} ] as specified in the Manifest file is not public.", 51 new Object [] {mainClass})); 52 } 53 } catch (ClassNotFoundException cnfe) { 54 if(debug) 55 cnfe.printStackTrace(); 56 addErrorDetails(result, compName); 57 result.failed(smh.getLocalString(getClass().getName() + ".failed1", 58 "ERROR: Appclient main-class [ {0} ] as specified in the" + 59 " Manifest file is not loadable.", 60 new Object [] {mainClass})); 61 } 62 } else { 63 addErrorDetails(result, compName); 64 result.failed(smh.getLocalString 65 (getClass().getName() + ".failed", 66 "Appclient main-class is not found. Please check the " + 67 "main-class entry of your appclient manifest file.")); 68 } 69 if(result.getStatus() != Result.FAILED) { 70 addGoodDetails(result, compName); 71 result.passed(smh.getLocalString(getClass().getName() + ".passed", 72 "main-class entry is defined properly.")); 73 } 74 return result; 75 } 76 } 77 | Popular Tags |