1 23 package com.sun.enterprise.tools.verifier.tests.web; 24 25 import java.util.*; 26 import com.sun.enterprise.deployment.*; 27 import com.sun.enterprise.tools.verifier.*; 28 import com.sun.enterprise.tools.verifier.tests.*; 29 30 31 35 public class TaglibUri extends Taglib implements WebCheck { 36 37 38 45 public Result check(WebBundleDescriptor descriptor) { 46 47 Result result = getInitializedResult(); 48 ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor(); 49 boolean failed = false; 50 TagLibConfigurationDescriptor taglibDescriptor; 51 String taglibUri; 52 Enumeration taglibConfig = (new Vector()).elements(); 53 if (descriptor.getJspConfigDescriptor() != null) { 54 taglibConfig = descriptor.getJspConfigDescriptor().getTagLibs(); 55 } 56 57 58 if (taglibConfig.hasMoreElements()){ 59 while (taglibConfig.hasMoreElements()) { 60 taglibDescriptor = (TagLibConfigurationDescriptor) taglibConfig.nextElement(); 62 taglibUri = taglibDescriptor.getTagLibURI(); 63 if (taglibUri.equals("")) { 64 failed = true; 65 result.addErrorDetails(smh.getLocalString 66 ("tests.componentNameConstructor", 67 "For [ {0} ]", 68 new Object [] {compName.toString()})); 69 result.addErrorDetails(smh.getLocalString 70 (getClass().getName() + ".failed", 71 "Error: taglib-uri should not be an empty string.")); 72 result.setStatus(Result.FAILED); 73 return result; 74 } 75 } 76 if (failed == false) { 77 result.addGoodDetails(smh.getLocalString 78 ("tests.componentNameConstructor", 79 "For [ {0} ]", 80 new Object [] {compName.toString()})); 81 result.addGoodDetails(smh.getLocalString 82 (getClass().getName() + ".passed", 83 "taglib-uri element is a non-empty string.")); 84 result.setStatus(Result.PASSED); 85 } else { 86 result.setStatus(Result.FAILED); 87 } 88 return result; 89 90 } else { 91 result.addNaDetails(smh.getLocalString 92 ("tests.componentNameConstructor", 93 "For [ {0} ]", 94 new Object [] {compName.toString()})); 95 result.notApplicable(smh.getLocalString 96 (getClass().getName() + ".notApplicable", 97 "There are no TagLibConfigurationDescriptors within the web archive [ {0} ]", 98 new Object [] {descriptor.getName()})); 99 result.setStatus(Result.NOT_APPLICABLE); 100 return result; 101 102 } 103 104 105 } 106 } 107 | Popular Tags |