[Title] Fix FileUtil bug
authorho.namkoong <ho.namkoong@samsung.com>
Mon, 12 Nov 2012 06:51:06 +0000 (15:51 +0900)
committerho.namkoong <ho.namkoong@samsung.com>
Mon, 12 Nov 2012 06:55:06 +0000 (15:55 +0900)
[Type]
[Module]
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: Ief14c5cb98e74406dc7e960b05feda5085fe20e1

org.tizen.common/src/org/tizen/common/util/FileUtil.java

index 5fe5d3c..0acd656 100755 (executable)
@@ -392,7 +392,7 @@ public class FileUtil {
      * @throws IOException
      */
     public static void copyRecursively(String from, String to, boolean overwrite) throws IOException {
-        copyRecursively(from, to, overwrite, null);
+        copyRecursively(from, to, overwrite, new File [0]);
     }
     
     /**
@@ -434,9 +434,13 @@ public class FileUtil {
 
     private static void copyRecursivelyWithoutDirChecking(File fromDir, File toDir, boolean overwrite, File... filters) throws IOException {
         HashSet<String> filterSet = new HashSet<String>();
-        for(File filter: filters) {
-            filterSet.add(filter.getCanonicalPath());
+        
+        if(filters != null) {
+            for(File filter: filters) {
+                filterSet.add(filter.getCanonicalPath());
+            }
         }
+        
         Stack<File> fromFileStack = new Stack<File>();
         Stack<File> toFileStack = new Stack<File>();
         
@@ -458,14 +462,7 @@ public class FileUtil {
             }
             else if(fromFile.isFile()) {
                 if(!toFile.exists() || !toFile.isFile() || overwrite) {
-                    boolean found = false;
-                    if(filters != null) {
-                        if(filterSet.contains(fromFile.getCanonicalPath())) {
-                            found = true;
-                            break;
-                        }
-                    }
-                    if(!found) {
+                    if(filterSet.size() == 0 || !filterSet.contains(fromFile.getCanonicalPath())) {
                         copyTo(fromFile, toFile, false);
                     }
                 }