我目前正在尝试上传多个文件,并且这些文件正在正确上传到目标目录中。但是在日志中它给了我这个错误:
javax.faces.el.EvaluationException: java.io.FileNotFoundException: /u01/app/Middleware/user_projects/domains/base_domain/servers/ServerProcessing1/logs/owsm/msglogging (Is a directory)
这是我上传文件的代码:
private String rFolder = null;
private File rootFolder = null;
rFolder = "/u01/app/Middleware/user_projects/domains/base_domain/servers/ServerProcessing1/logs";
rootFolder = new File(rFolder);
archivatingProcess();
private void archivatingProcess() throws FileNotFoundException, IOException {
File file = new File(rFolder);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(file.getAbsoluteFile() + ".zip"));
addDir(file, zos);
zos.close();
}
private void addDir(File rootFolder, ZipOutputStream zos) throws FileNotFoundException, IOException {
File[] files = rootFolder.listFiles();
int fLength = files.length;
byte[] buff = new byte[1024];
for (int i = 0; i < fLength; i++) {
if (files[i].isDirectory()) {
zos.putNextEntry(new ZipEntry(files[i].getName() + "/"));
zos.closeEntry();
File[] fileIn = files[i].listFiles();
for (File f : fileIn) {
FileInputStream fis =
new FileInputStream(f.getAbsolutePath());
zos.putNextEntry(new ZipEntry(files[i].getName() + "/" + f.getName()));
int len;
while ((len = fis.read(buff)) > 0) {
zos.write(buff, 0, len);
}
zos.closeEntry();
fis.close();
}
} else {
FileInputStream fis = new FileInputStream(files[i].getAbsolutePath());
zos.putNextEntry(new ZipEntry(files[i].getName()));
int len;
while ((len = fis.read(buff)) > 0) {
zos.write(buff, 0, len);
}
zos.closeEntry();
fis.close();
}
}
}
由于我是java的新手,我不确定为什么它会给我这个错误。我该如何调试呢?