Namefiles with special characters prevents JOnAS from deploying the directory.war (containing those files)
A directory considered as a war inside JOnAS could not be deployed if ever a file whose finename contains special characters. e.g. File = ..../UPL15079_montgolfi�res.htm Message log: 2012-07-13 10:48:34,221 : FINE : Thread-8 : DeployableMonitor.getFileSize : File processed /home/mateo/jonasbases/myJOnASfix-523/deploy/rh.war/media/rh_ed_marXXXXX/UPL15079_montgolfi�res.htm 2012-07-13 10:48:34,221 : FINE : Thread-8 : DeployableMonitor.saveFileLengths : SPECIAL-mess: saveFileLengths 2012-07-13 10:48:34,222 : FINE : Thread-8 : DeployableMonitor.saveFileLengths : java.lang.NullPointerException
Proposal code to fix it (DeployableMonitor.java - getFileSize():
/* Tested with a sample case = OK / / Tested inside directory furnished with war,ear,xml files = OK */
private static long getFileSize(final File file) throws Exception {
if (file.isFile()) {
checkFileCompleteness(file);
return file.length();
}
else if (file.isDirectory()) {
// Directory case
long size = 0;
File[] childs = file.listFiles();
for (File child : childs) {
logger.debug("File processed " + child);
// Add the size of the child
size += getFileSize(child);
}
return size;
}
else {
// not a regular file and not a directory
return 0;
}
}
Message log with previous and next processed files:
2012-07-13 10:52:45,129 : FINE : Thread-8 : DeployableMonitor.getFileSize : File processed /home/mateo/jonasbases/myJOnASfix-523/deploy/rh.war/media/rh_ed_marXXXXX/UPL4056_XXXXXXXX_espacedev_newslette.gif 2012-07-13 10:52:45,129 : FINE : Thread-8 : DeployableMonitor.getFileSize : File processed /home/mateo/jonasbases/myJOnASfix-523/deploy/rh.war/media/rh_ed_marXXXXX/UPL15079_montgolfi�res.htm 2012-07-13 10:52:45,130 : FINE : Thread-8 : DeployableMonitor.getFileSize : File processed /home/mateo/jonasbases/myJOnASfix-523/deploy/rh.war/media/rh_ed_marXXXXX/UPL42901_RemXXXXXX.htm