From dad79f76b03265b8a0623520e586657d7bdcc2b0 Mon Sep 17 00:00:00 2001 From: "ho.namkoong" Date: Mon, 12 Nov 2012 15:51:06 +0900 Subject: [PATCH] [Title] Fix FileUtil bug [Type] [Module] [Priority] [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] Change-Id: Ief14c5cb98e74406dc7e960b05feda5085fe20e1 --- .../src/org/tizen/common/util/FileUtil.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/org.tizen.common/src/org/tizen/common/util/FileUtil.java b/org.tizen.common/src/org/tizen/common/util/FileUtil.java index 5fe5d3c..0acd656 100755 --- a/org.tizen.common/src/org/tizen/common/util/FileUtil.java +++ b/org.tizen.common/src/org/tizen/common/util/FileUtil.java @@ -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 filterSet = new HashSet(); - for(File filter: filters) { - filterSet.add(filter.getCanonicalPath()); + + if(filters != null) { + for(File filter: filters) { + filterSet.add(filter.getCanonicalPath()); + } } + Stack fromFileStack = new Stack(); Stack toFileStack = new Stack(); @@ -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); } } -- 2.7.4