Jsp file in Servlet 2.2 applications must start with a leading /
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
String specVersion = descriptor.getSpecVersion();
Float specVer = new Float(specVersion);
if (!descriptor.getJspDescriptors().isEmpty()) {
boolean oneFailed = false;
int count = getNonRuntimeCountNodeSet("/web-app/servlet");
for(int i=1;i<=count;i++){
String jspFilename = getXPathValueForNonRuntime("/web-app/servlet["+i+"]/jsp-file");
if(jspFilename!=null){
if (jspFilename.startsWith("/")){
if(specVer.compareTo(new Float("2.3"))<0){
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed",
" PASSED : Jsp Name [ {0} ] is valid",
new Object[] { jspFilename }));
}else{
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed1",
" Jsp Name [ {0} ] is valid and starts with a leading '/'",
new Object[] { jspFilename }));
}
}else{
if(specVer.compareTo(new Float("2.3"))<0){
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed",
" PASSED Jsp Name [ {0} ] is valid",
new Object[] { jspFilename }));
}else{
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failed",
" Error : Jsp Name [ {0} ] in invalid as it does not start with a leading '/'",
new Object[] { jspFilename }));
oneFailed=true;
}
}
}
}
if (oneFailed) {
result.setStatus(Result.FAILED);
} else {
result.setStatus(Result.PASSED);
}
} else {
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"There are no Jsp components within the web archive [ {0} ]",
new Object[] {descriptor.getName()}));
}
return result;