This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 5bbec5435ae4d1d607995a404ff51fe8bde7a58a
Author: Tung Tran <[email protected]>
AuthorDate: Tue Jul 18 15:17:51 2023 +0700

    [CLEAN CODE] - Maven - Drop import commons-io when un-used
---
 mailbox/api/pom.xml                                     |  4 ----
 mailbox/store/pom.xml                                   |  4 ----
 mailet/amqp/pom.xml                                     |  4 ----
 mailet/crypto/pom.xml                                   |  4 ----
 mailet/icalendar/pom.xml                                |  5 -----
 mailet/standard/pom.xml                                 |  4 ----
 protocols/managesieve/pom.xml                           |  4 ----
 server/apps/webadmin-cli/pom.xml                        |  4 ----
 server/blob/blob-aes/pom.xml                            |  4 ----
 server/blob/blob-api/pom.xml                            |  5 -----
 server/blob/blob-s3/pom.xml                             |  4 ----
 server/container/filesystem-api/pom.xml                 |  4 ----
 .../james/filesystem/api/AbstractFileSystemTest.java    | 17 ++++++++++-------
 server/container/util/pom.xml                           |  4 ----
 server/protocols/protocols-imap4/pom.xml                |  4 ----
 third-party/spamassassin/pom.xml                        |  5 -----
 16 files changed, 10 insertions(+), 70 deletions(-)

diff --git a/mailbox/api/pom.xml b/mailbox/api/pom.xml
index cbd95d5428..5c8abab569 100644
--- a/mailbox/api/pom.xml
+++ b/mailbox/api/pom.xml
@@ -76,10 +76,6 @@
             <groupId>com.sun.mail</groupId>
             <artifactId>javax.mail</artifactId>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
         <dependency>
             <groupId>io.projectreactor</groupId>
             <artifactId>reactor-core</artifactId>
diff --git a/mailbox/store/pom.xml b/mailbox/store/pom.xml
index 7bf36d590a..21e04fd007 100644
--- a/mailbox/store/pom.xml
+++ b/mailbox/store/pom.xml
@@ -90,10 +90,6 @@
             <groupId>com.sun.mail</groupId>
             <artifactId>javax.mail</artifactId>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
         <dependency>
             <groupId>javax.inject</groupId>
             <artifactId>javax.inject</artifactId>
diff --git a/mailet/amqp/pom.xml b/mailet/amqp/pom.xml
index 1f3c30a4c4..1ef17b43e5 100644
--- a/mailet/amqp/pom.xml
+++ b/mailet/amqp/pom.xml
@@ -83,10 +83,6 @@
             <groupId>com.sun.mail</groupId>
             <artifactId>javax.mail</artifactId>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
         <dependency>
             <groupId>javax.annotation</groupId>
             <artifactId>javax.annotation-api</artifactId>
diff --git a/mailet/crypto/pom.xml b/mailet/crypto/pom.xml
index d7b5bc4f4a..2d75b73383 100644
--- a/mailet/crypto/pom.xml
+++ b/mailet/crypto/pom.xml
@@ -54,10 +54,6 @@
             <groupId>com.sun.mail</groupId>
             <artifactId>javax.mail</artifactId>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
         <dependency>
             <groupId>javax.inject</groupId>
             <artifactId>javax.inject</artifactId>
diff --git a/mailet/icalendar/pom.xml b/mailet/icalendar/pom.xml
index 10a17b255b..0ac4dd410d 100644
--- a/mailet/icalendar/pom.xml
+++ b/mailet/icalendar/pom.xml
@@ -64,11 +64,6 @@
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>net.javacrumbs.json-unit</groupId>
             <artifactId>json-unit-assertj</artifactId>
diff --git a/mailet/standard/pom.xml b/mailet/standard/pom.xml
index 3b3d09684c..b2104cc569 100644
--- a/mailet/standard/pom.xml
+++ b/mailet/standard/pom.xml
@@ -76,10 +76,6 @@
             <groupId>com.sun.mail</groupId>
             <artifactId>javax.mail</artifactId>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
         <dependency>
             <groupId>javax.annotation</groupId>
             <artifactId>javax.annotation-api</artifactId>
diff --git a/protocols/managesieve/pom.xml b/protocols/managesieve/pom.xml
index 0b2b1092ea..d7616bfbbf 100644
--- a/protocols/managesieve/pom.xml
+++ b/protocols/managesieve/pom.xml
@@ -50,10 +50,6 @@
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
         <dependency>
             <groupId>javax.annotation</groupId>
             <artifactId>javax.annotation-api</artifactId>
diff --git a/server/apps/webadmin-cli/pom.xml b/server/apps/webadmin-cli/pom.xml
index b794c650a4..14ef613d61 100644
--- a/server/apps/webadmin-cli/pom.xml
+++ b/server/apps/webadmin-cli/pom.xml
@@ -67,10 +67,6 @@
             <artifactId>testing-base</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
         <dependency>
             <groupId>info.picocli</groupId>
             <artifactId>picocli</artifactId>
diff --git a/server/blob/blob-aes/pom.xml b/server/blob/blob-aes/pom.xml
index f24a3cbf25..3de703d6af 100644
--- a/server/blob/blob-aes/pom.xml
+++ b/server/blob/blob-aes/pom.xml
@@ -62,10 +62,6 @@
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
         <dependency>
             <groupId>io.projectreactor</groupId>
             <artifactId>reactor-core</artifactId>
diff --git a/server/blob/blob-api/pom.xml b/server/blob/blob-api/pom.xml
index 5613a52e17..4e15cfebd9 100644
--- a/server/blob/blob-api/pom.xml
+++ b/server/blob/blob-api/pom.xml
@@ -60,11 +60,6 @@
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>io.projectreactor.addons</groupId>
             <artifactId>reactor-extra</artifactId>
diff --git a/server/blob/blob-s3/pom.xml b/server/blob/blob-s3/pom.xml
index dee65d2514..668ec999ca 100644
--- a/server/blob/blob-s3/pom.xml
+++ b/server/blob/blob-s3/pom.xml
@@ -69,10 +69,6 @@
             <artifactId>testing-base</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
         <dependency>
             <groupId>io.netty</groupId>
             <artifactId>netty-codec</artifactId>
diff --git a/server/container/filesystem-api/pom.xml 
b/server/container/filesystem-api/pom.xml
index 8a9b8c49ac..45ddafe090 100644
--- a/server/container/filesystem-api/pom.xml
+++ b/server/container/filesystem-api/pom.xml
@@ -43,10 +43,6 @@
             <artifactId>spark-core</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
         <dependency>
             <groupId>pl.pragmatists</groupId>
             <artifactId>JUnitParams</artifactId>
diff --git 
a/server/container/filesystem-api/src/test/java/org/apache/james/filesystem/api/AbstractFileSystemTest.java
 
b/server/container/filesystem-api/src/test/java/org/apache/james/filesystem/api/AbstractFileSystemTest.java
index 34972dcad5..5ba49f7723 100644
--- 
a/server/container/filesystem-api/src/test/java/org/apache/james/filesystem/api/AbstractFileSystemTest.java
+++ 
b/server/container/filesystem-api/src/test/java/org/apache/james/filesystem/api/AbstractFileSystemTest.java
@@ -22,12 +22,11 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.File;
 import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
 
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
@@ -74,7 +73,9 @@ public abstract class AbstractFileSystemTest {
     private void createSubFolderWithAFileIn(String folderName, String 
fileName, String fileContent) throws IOException {
         File folder = tmpFolder.newFolder(folderName);
         File file = new File(folder.getAbsolutePath() + "/" + fileName);
-        FileUtils.writeStringToFile(file, fileContent, StandardCharsets.UTF_8);
+        try (var out = new FileOutputStream(file)) {
+            out.write(fileContent.getBytes(StandardCharsets.UTF_8));
+        }
     }
 
     @After
@@ -185,7 +186,7 @@ public abstract class AbstractFileSystemTest {
     public final void availableInputStreamShouldReturnANonEmptyStream(String 
url) throws Exception {
         url = replacePort(url);
         try (InputStream inputStream = fileSystem.getResource(url)) {
-            
assertThat(IOUtils.toByteArray(inputStream).length).isGreaterThan(0);
+            assertThat(inputStream.readAllBytes().length).isGreaterThan(0);
         }
     }
 
@@ -231,7 +232,7 @@ public abstract class AbstractFileSystemTest {
     public final void createdFilesAsInputStreamShouldBeAvailable(String name, 
String extension) throws Exception {
         File temp = createTempFile(name, extension);
         try (InputStream inputStream = fileSystem.getResource("file:" + 
temp.getAbsolutePath())) {
-            assertThat(IOUtils.toString(inputStream, 
StandardCharsets.UTF_8)).isEqualTo("content");
+            assertThat(new String(inputStream.readAllBytes(), 
StandardCharsets.UTF_8)).isEqualTo("content");
         } finally {
             temp.delete();
         }
@@ -242,7 +243,7 @@ public abstract class AbstractFileSystemTest {
     public final void 
createdFilesAsInputStreamShouldBeAvailableWhenAccessedWithTwoSlashes(String 
name, String extension) throws Exception {
         File temp = createTempFile(name, extension);
         try (InputStream inputStream = fileSystem.getResource("file://" + 
temp.getAbsolutePath())) {
-            assertThat(IOUtils.toString(inputStream, 
StandardCharsets.UTF_8)).isEqualTo("content");
+            assertThat(new String(inputStream.readAllBytes(), 
StandardCharsets.UTF_8)).isEqualTo("content");
         } finally {
             temp.delete();
         }
@@ -250,7 +251,9 @@ public abstract class AbstractFileSystemTest {
 
     private File createTempFile(String name, String extension) throws 
IOException {
         File temp = File.createTempFile(name, extension);
-        FileUtils.write(temp, "content", StandardCharsets.UTF_8);
+        try (var out = new FileOutputStream(temp)) {
+            out.write("content".getBytes(StandardCharsets.UTF_8));
+        }
         return temp;
     }
 
diff --git a/server/container/util/pom.xml b/server/container/util/pom.xml
index 979d6fde25..d57bb50eb9 100644
--- a/server/container/util/pom.xml
+++ b/server/container/util/pom.xml
@@ -55,10 +55,6 @@
             <groupId>com.sun.mail</groupId>
             <artifactId>javax.mail</artifactId>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
         <dependency>
             <groupId>io.projectreactor</groupId>
             <artifactId>reactor-core</artifactId>
diff --git a/server/protocols/protocols-imap4/pom.xml 
b/server/protocols/protocols-imap4/pom.xml
index dc10440794..4c3b829372 100644
--- a/server/protocols/protocols-imap4/pom.xml
+++ b/server/protocols/protocols-imap4/pom.xml
@@ -122,10 +122,6 @@
             <groupId>com.jcraft</groupId>
             <artifactId>jzlib</artifactId>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
         <dependency>
             <groupId>io.github.hakky54</groupId>
             <artifactId>sslcontext-kickstart-for-pem</artifactId>
diff --git a/third-party/spamassassin/pom.xml b/third-party/spamassassin/pom.xml
index 607e84e00a..dd1580346a 100644
--- a/third-party/spamassassin/pom.xml
+++ b/third-party/spamassassin/pom.xml
@@ -158,11 +158,6 @@
             <artifactId>javax.mail</artifactId>
             <scope>provided</scope>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <scope>provided</scope>
-        </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to