Replace calls to FileUtils.touch with calls to similar methods.
FileUtils.touch is changing behavior, including:
- not creating parent directories when necessary
- failing when the file is a symlink to a non-existent file, or
something like that?
This change was proposed as a Google-internal CL and this change is
applying it in the open source project.
Change-Id: I495072fca9f48349e4391cf905935fa82729f752
Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/TestUtils.java b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/TestUtils.java
index f18295e..358e527 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/TestUtils.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/uploadvalidator/TestUtils.java
@@ -19,6 +19,7 @@
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.Lists;
+import com.google.common.io.Files;
import com.google.gerrit.server.config.PluginConfig;
import com.google.gerrit.server.git.validators.CommitValidationMessage;
import java.io.File;
@@ -105,7 +106,8 @@
AddCommand ac = git.add();
for (File f : files.keySet()) {
if (!f.exists()) {
- FileUtils.touch(f);
+ Files.createParentDirs(f);
+ Files.write(new byte[0], f);
}
if (files.get(f) != null) {
FileUtils.writeByteArrayToFile(f, files.get(f));