FELIX-1776: problem when using relative dirs
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@938115 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Scanner.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Scanner.java
index 54a5b87..8f5623d 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Scanner.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/Scanner.java
@@ -20,6 +20,7 @@
import java.io.File;
import java.io.FilenameFilter;
+import java.io.IOException;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
@@ -107,7 +108,7 @@
Set/*<File>*/ removed = new HashSet/*<File>*/(storedChecksums.keySet());
for (int i = 0; i < list.length; i++)
{
- File file = list[i];
+ File file = canon(list[i]);
long lastChecksum = lastChecksums.get(file) != null ? ((Long) lastChecksums.get(file)).longValue() : 0;
long storedChecksum = storedChecksums.get(file) != null ? ((Long) storedChecksums.get(file)).longValue() : 0;
long newChecksum = checksum(file);
@@ -132,6 +133,18 @@
return files;
}
+ private static File canon(File file)
+ {
+ try
+ {
+ return file.getCanonicalFile();
+ }
+ catch (IOException e)
+ {
+ return file;
+ }
+ }
+
/**
* Retrieve the previously computed checksum for a give file.
*