[
https://issues.apache.org/jira/browse/MSITE-945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17869166#comment-17869166
]
ASF GitHub Bot commented on MSITE-945:
--------------------------------------
elharo commented on code in PR #202:
URL: https://github.com/apache/maven-site-plugin/pull/202#discussion_r1694234300
##########
src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java:
##########
@@ -219,14 +221,14 @@ 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);
+ File fileToTest = new File(siteTargetPath, "site" + File.separator +
"index.html");
+ assertTrue(fileToTest.exists());
+ String fileContent = readFileToString(fileToTest);
assertTrue(fileContent.contains("Welcome to Apache Maven"));
- File cssFile = new File(siteTargetPath, "site" + File.separator +
"css" + File.separator + "maven-base.css");
- assertTrue(cssFile.exists());
- fileContent = FileUtils.readFileToString(cssFile,
StandardCharsets.UTF_8);
+ fileToTest = new File(siteTargetPath, "site" + File.separator + "css"
+ File.separator + "maven-base.css");
Review Comment:
Please don't reuse local variables for different things. It's very prone.
##########
src/test/java/org/apache/maven/plugins/site/deploy/SimpleDavServerHandler.java:
##########
@@ -111,4 +112,17 @@ public int getPort() {
public void stop() throws Exception {
server.stop();
}
+
+ private void writeByteArrayToFile(File targetFile, ServletInputStream
inputStream) throws IOException {
+ int nRead;
+ byte[] data = new byte[512];
Review Comment:
larger buffer in 2024, maybe 4K
##########
src/test/java/org/apache/maven/plugins/site/deploy/AbstractSiteDeployWebDavTest.java:
##########
@@ -247,4 +249,26 @@ private boolean
assertAtLeastOneRequestContainsHeader(List<HttpRequest> requests
}
return false;
}
+
+ private void cleanDirectory(File dir) throws IOException {
Review Comment:
This should be done with a JUnit tenmporary directory. No need to invent
this code. I sent a PR for that.
##########
src/test/java/org/apache/maven/plugins/site/deploy/SimpleDavServerHandler.java:
##########
@@ -111,4 +112,17 @@ public int getPort() {
public void stop() throws Exception {
server.stop();
}
+
+ private void writeByteArrayToFile(File targetFile, ServletInputStream
inputStream) throws IOException {
Review Comment:
writeInputStreamToFile
> Remove dependency on Commons IO
> -------------------------------
>
> Key: MSITE-945
> URL: https://issues.apache.org/jira/browse/MSITE-945
> Project: Maven Site Plugin
> Issue Type: Dependency upgrade
> Reporter: Elliotte Rusty Harold
> Priority: Major
> Labels: up-for-grabs
>
> All uses look easily replaceable by standard JDK methods these days
--
This message was sent by Atlassian Jira
(v8.20.10#820010)