The Web form-error-page value defines the location in the web application
where the page can be used for error page can be found within web
application test
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor.getLoginConfiguration() != null) {
boolean foundIt = false;
// ZipEntry ze=null;
// JarFile jar=null;
FileArchive arch=null;
String formErrorPage = descriptor.getLoginConfiguration().getFormErrorPage();
if (formErrorPage.length() > 0) {
try{
// File f = Verifier.getArchiveFile(descriptor.getModuleDescriptor().getArchiveUri());
// if(f==null){
String uri=getAbstractArchiveUri(descriptor);
try{
arch = new FileArchive();
arch.open(uri);
}catch(IOException e){
throw e;
}
// }else{
// jar = new JarFile(f);
// }
if (formErrorPage.startsWith("/"))
formErrorPage=formErrorPage.substring(1);
// if (f!=null){
// ze = jar.getEntry(formErrorPage);
// foundIt = (ze != null);
// }
// else{
File fep = new File(arch.getArchiveUri() + File.separator + formErrorPage);
if(fep.exists())
foundIt=true;
fep = null;
// }
// if (jar!=null)
// jar.close();
}catch (Exception ex) {
//should be aldready set?
foundIt = false;
}
if (foundIt) {
result.addGoodDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.passed(smh.getLocalString
(getClass().getName() + ".passed",
"The form-error-page [ {0} ] value defines the location in the web application where the error page that is displayed when login is not successful can be found within web application [ {1} ]",
new Object[] {formErrorPage, descriptor.getName()}));
} else {
result.addErrorDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.failed(smh.getLocalString
(getClass().getName() + ".failed",
"Error: The form-error-page [ {0} ] value does not define the location in the web application where the error page that is displayed when login is not successful can be found within web application [ {1} ]",
new Object[] {formErrorPage, descriptor.getName()}));
}
} else {
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"There are no form-error-page elements within this web archive [ {0} ]",
new Object[] {descriptor.getName()}));
}
} else {
result.addNaDetails(smh.getLocalString
("tests.componentNameConstructor",
"For [ {0} ]",
new Object[] {compName.toString()}));
result.notApplicable(smh.getLocalString
(getClass().getName() + ".notApplicable",
"There are no form-error-page elements within this web archive [ {0} ]",
new Object[] {descriptor.getName()}));
}
return result;