* @param fileID The archive file name
* @param result where to place the result
*/
public static void testFileExistence(String uri, String fileName, String fileID, Result result) {
FileArchive arch=null;
// ZipEntry ze=null;
JarFile jarFile=null;
if (fileName == null || fileName.length()==0) {
result.notApplicable(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.VerifierTest.fileexistence.notApplicable",
"No {0} defined in deployment descriptors",
new Object[] {fileID}));
return;
}
// if (file==null){
try{
arch = new FileArchive();
arch.open(uri);
}catch(Exception e){}
// }else{
// try {
// jarFile = new JarFile(file);
// } catch (java.io.IOException ioe) {
// Verifier.debug(ioe);
// result.failed(smh.getLocalString
// ("com.sun.enterprise.tools.verifier.tests.VerifierTest.fileexistence.failed",
// "Error: {0} [ {1} ] not found in the archive",
// new Object[] {fileID, fileName}));
// return;
// }
// }
try{
// if (file!=null){
// ze = jarFile.getEntry(fileName);
// if (ze == null) {
// result.failed(smh.getLocalString
// ("com.sun.enterprise.tools.verifier.tests.VerifierTest.fileexistence.failed",
// "Error: {0} [ {1} ] not found in the archive",
// new Object[] {fileID, fileName}));
// }else{
// result.passed(smh.getLocalString
// ("com.sun.enterprise.tools.verifier.tests.VerifierTest.fileexistence.passed",
// "{0} [ {1} ] found in the archive",
// new Object[] {fileID, fileName}));
// }
// }
// else{
File urif = new File(arch.getArchiveUri()+File.separator+fileName);
if(urif.exists()){
result.passed(smh.getLocalString
("com.sun.enterprise.tools.verifier.tests.VerifierTest.fileexistence.passed",
"{0} [ {1} ] found in the archive",
new Object[] {fileID, fileName}));