Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MSITE-945] Remove dependency on Commons IO #202

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,6 @@ under the License.
<scope>test</scope>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.16.1</version>
<scope>test</scope>
</dependency>

<!-- test -->
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 htmlContent = new String(Files.readAllBytes(htmlFile.toPath()), StandardCharsets.UTF_8);
assertTrue(htmlContent.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);"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Loading