1 23 24 29 30 package com.sun.enterprise.tools.verifier.tests.app; 31 32 import com.sun.enterprise.deployment.Application; 33 import com.sun.enterprise.tools.verifier.Result; 34 import java.io.IOException ; 35 import java.util.jar.Attributes ; 36 import java.util.jar.Manifest ; 37 38 47 48 public class EARFileUsesClassPath extends ApplicationTest implements AppCheck { 49 public Result check(Application descriptor){ 50 Result result = getInitializedResult(); 51 result.setStatus(Result.FAILED); 52 try{ 53 Manifest manifest=getVerifierContext().getAbstractArchive().getManifest(); 54 String cp=null; 55 if (manifest!=null) 56 cp=manifest.getMainAttributes().getValue(Attributes.Name.CLASS_PATH); 57 if(cp==null || cp.length()==0){ 58 result.passed(smh.getLocalString(getClass().getName() + ".passed", 59 "Manifest file of this EAR file does not contain any Class-Path entry.")); 60 }else{ 61 result.failed(smh.getLocalString(getClass().getName() + ".failed", 62 "Manifest file of this EAR file contains [ {0} ] as the Class-Path entry.", 63 new Object []{cp})); 64 } 65 }catch(IOException e){ 66 result.addErrorDetails(e.toString()); 67 } 68 return result; 69 } 70 } 71 | Popular Tags |