Replace deprecated FileUtils with nio Grappa deprecated FileUtils in favor of using nio directly. Hence, we switch to nio. Change-Id: Iec43a511835edf77878f3811c915705b2a5e8e38
diff --git a/BUCK b/BUCK index 581deae..1bbb56a 100644 --- a/BUCK +++ b/BUCK
@@ -6,9 +6,6 @@ '//lib/guice:guice', '//lib/jgit:jgit', '//lib/log:api', - '//lib:grappa', # used for it's parboiled part. See - # core's 0db7612e092b37c6ea04883a5a45f51c6d9ae433 - # for details '//lib:velocity', ]
diff --git a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddVelocityComment.java b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddVelocityComment.java index d8e3b59..f3a1cc2 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddVelocityComment.java +++ b/src/main/java/com/googlesource/gerrit/plugins/its/base/workflow/action/AddVelocityComment.java
@@ -25,13 +25,13 @@ import org.apache.commons.lang.StringUtils; import org.apache.velocity.VelocityContext; import org.apache.velocity.runtime.RuntimeInstance; -import org.parboiled.common.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.io.StringWriter; +import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; import java.util.Set; @@ -105,12 +105,12 @@ if (templateName.isEmpty()) { log.error("No template name given in " + actionRequest); } else { - File templateFile = new File(sitePath.toFile(), ITS_TEMPLATE_DIR + - File.separator + templateName + ".vm"); - if (templateFile.canRead()) { - template = FileUtils.readAllText(templateFile); + Path templateDir = sitePath.resolve(ITS_TEMPLATE_DIR); + Path templatePath = templateDir.resolve(templateName + ".vm"); + if (Files.isReadable(templatePath)) { + template = new String(Files.readAllBytes(templatePath)); } else { - log.error("Cannot read template " + templateFile); + log.error("Cannot read template " + templatePath); } } }