diff --git a/pom.xml b/pom.xml index 4c14fb2f..1977837e 100644 --- a/pom.xml +++ b/pom.xml @@ -487,13 +487,6 @@ under the License. test - - commons-io - commons-io - 2.16.1 - test - - org.apache.maven.plugin-testing diff --git a/src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java b/src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java index a245f79d..58e4fbca 100644 --- a/src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java +++ b/src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java @@ -20,13 +20,13 @@ import java.io.File; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.io.FileUtils; import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; import org.apache.maven.bridge.MavenRepositorySystem; import org.apache.maven.doxia.tools.SiteTool; @@ -220,12 +220,12 @@ public void davDeployThruProxyWitAuthzInProxy() throws Exception { private void assertContentInFiles() throws Exception { File htmlFile = new File(siteTargetPath, "site" + File.separator + "index.html"); assertTrue(htmlFile.exists()); - String fileContent = FileUtils.readFileToString(htmlFile, StandardCharsets.UTF_8); - assertTrue(fileContent.contains("Welcome to Apache Maven")); + String htmlFileContent = new String(Files.readAllBytes(htmlFile.toPath()), StandardCharsets.UTF_8); + assertTrue(htmlFileContent.contains("Welcome to Apache Maven")); File cssFile = new File(siteTargetPath, "site" + File.separator + "css" + File.separator + "maven-base.css"); assertTrue(cssFile.exists()); - String cssContent = FileUtils.readFileToString(cssFile, StandardCharsets.UTF_8); + String cssContent = new String(Files.readAllBytes(cssFile.toPath()), StandardCharsets.UTF_8); assertTrue(cssContent.contains("background-image: url(../images/collapsed.gif);")); } diff --git a/src/test/java/org/apache/maven/plugins/site/deploy/AuthAsyncProxyServlet.java b/src/test/java/org/apache/maven/plugins/site/deploy/AuthAsyncProxyServlet.java index c7a40b0e..0c654c9f 100644 --- a/src/test/java/org/apache/maven/plugins/site/deploy/AuthAsyncProxyServlet.java +++ b/src/test/java/org/apache/maven/plugins/site/deploy/AuthAsyncProxyServlet.java @@ -26,10 +26,13 @@ import java.io.File; import java.io.IOException; -import java.util.*; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Enumeration; +import java.util.List; +import java.util.Map; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; import org.eclipse.jetty.proxy.AsyncProxyServlet; /** @@ -121,7 +124,8 @@ public void service(ServletRequest req, ServletResponse res) throws ServletExcep if (request.getMethod().equalsIgnoreCase("PUT") && targetPath != null) { File targetFile = new File(siteTargetPath, targetPath); - FileUtils.writeByteArrayToFile(targetFile, IOUtils.toByteArray(request.getInputStream())); + targetFile.getParentFile().mkdirs(); + Files.copy(request.getInputStream(), targetFile.toPath()); } response.setStatus(HttpServletResponse.SC_OK); diff --git a/src/test/java/org/apache/maven/plugins/site/deploy/SimpleDavServerHandler.java b/src/test/java/org/apache/maven/plugins/site/deploy/SimpleDavServerHandler.java index 0e0b26fb..78f780b9 100644 --- a/src/test/java/org/apache/maven/plugins/site/deploy/SimpleDavServerHandler.java +++ b/src/test/java/org/apache/maven/plugins/site/deploy/SimpleDavServerHandler.java @@ -25,12 +25,11 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Server; @@ -74,7 +73,8 @@ public void handle(String target, Request r, HttpServletRequest request, HttpSer if (request.getMethod().equalsIgnoreCase("PUT")) { File targetFile = new File(siteTargetPath, targetPath); - FileUtils.writeByteArrayToFile(targetFile, IOUtils.toByteArray(request.getInputStream())); + targetFile.getParentFile().mkdirs(); + Files.copy(request.getInputStream(), targetFile.toPath()); } // PrintWriter writer = response.getWriter();