Tag library existence test.
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
boolean failed = false;
TagLibConfigurationDescriptor taglibDescriptor;
String taglibUri;
Enumeration taglibConfig = (new Vector()).elements();
if (descriptor.getJspConfigDescriptor() != null) {
taglibConfig = descriptor.getJspConfigDescriptor().getTagLibs();
}
if (taglibConfig.hasMoreElements()){
while (taglibConfig.hasMoreElements()) {
// test all the Tag lib descriptors.
taglibDescriptor = (TagLibConfigurationDescriptor) taglibConfig.nextElement();
taglibUri = taglibDescriptor.getTagLibURI();
if (taglibUri.equals("")) {
failed = true;
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addErrorDetails(smh.getLocalString
(getClass().getName() + ".failed",
"Error: taglib-uri should not be an empty string."));
result.setStatus(Result.FAILED);
return result;
}
}
if (failed == false) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addGoodDetails(smh.getLocalString
(getClass().getName() + ".passed",
"taglib-uri element is a non-empty string."));
result.setStatus(Result.PASSED);
} else {
result.setStatus(Result.FAILED);
}
return result;
} else {
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"There are no TagLibConfigurationDescriptors within the web archive [ {0} ]",
new Object[] {descriptor.getName()}));
result.setStatus(Result.NOT_APPLICABLE);
return result;
}