import java.io.File;
+import java.io.IOException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
set.add(url);
} else if (repository.getType() == RepositoryType.GLOB) {
File directory=new File(repository.getLocation());
+ directory = new File(directory.getCanonicalPath());
if (!validateFile(directory, RepositoryType.GLOB)) {
continue;
}
}
private static boolean validateFile(File file,
- RepositoryType type) {
+ RepositoryType type) throws IOException {
if (RepositoryType.DIR == type || RepositoryType.GLOB == type) {
if (!file.exists() || !file.isDirectory() || !file.canRead()) {
- String msg = "Problem with directory [" +
- file.getAbsolutePath() + "], exists: [" +
- file.exists() + "], isDirectory: [" +
- file.isDirectory() + "], canRead: [" +
- file.canRead() + "]";
+ String msg = "Problem with directory [" + file +
+ "], exists: [" + file.exists() +
+ "], isDirectory: [" + file.isDirectory() +
+ "], canRead: [" + file.canRead() + "]";
- if (!Bootstrap.getCatalinaHome().equals(
- Bootstrap.getCatalinaBase()) &&
- file.getAbsolutePath().startsWith(
- Bootstrap.getCatalinaBase())) {
-
+ File home = new File (Bootstrap.getCatalinaHome());
+ home = home.getCanonicalFile();
+ File base = new File (Bootstrap.getCatalinaBase());
+ base = base.getCanonicalFile();
+
+ if (!home.getPath().equals(base.getPath()) &&
+ file.getPath().startsWith(base.getPath())) {
log.debug(msg);
} else {
log.warn(msg);
}
} else if (RepositoryType.JAR == type) {
if (!file.exists() || !file.canRead()) {
- log.warn("Problem with JAR file [" +
- file.getAbsolutePath() + "], exists: [" +
- file.exists() + "], canRead: [" +
- file.canRead() + "]");
+ log.warn("Problem with JAR file [" + file +
+ "], exists: [" + file.exists() +
+ "], canRead: [" + file.canRead() + "]");
return false;
}
}