diff --git a/dependencies/build.gradle b/dependencies/build.gradle index 62637fe1..0c9982c2 100644 --- a/dependencies/build.gradle +++ b/dependencies/build.gradle @@ -30,7 +30,6 @@ dependencies { api "commons-cli:commons-cli:1.5.0" api "commons-collections:commons-collections:3.2.2" api "commons-httpclient:commons-httpclient:3.1" - api "commons-io:commons-io:2.11.0" api "commons-lang:commons-lang:2.6" api "commons-logging:commons-logging:1.2" api "commons-pool:commons-pool:1.6" diff --git a/ldif/ldif-core/build.gradle b/ldif/ldif-core/build.gradle index e42ede08..b0aed199 100644 --- a/ldif/ldif-core/build.gradle +++ b/ldif/ldif-core/build.gradle @@ -9,7 +9,6 @@ dependencies { testImplementation platform('org.junit:junit-bom') testImplementation "org.junit.vintage:junit-vintage-engine" testImplementation "junit:junit" - testImplementation "commons-io:commons-io" testImplementation "org.assertj:assertj-core" testImplementation ("log4j:log4j:1.2.17") { exclude group: 'javax.jms' diff --git a/ldif/ldif-core/src/test/java/org/springframework/ldap/ldif/Ldap233LdifParserTests.java b/ldif/ldif-core/src/test/java/org/springframework/ldap/ldif/Ldap233LdifParserTests.java index 7dbcb74f..c8f8739f 100644 --- a/ldif/ldif-core/src/test/java/org/springframework/ldap/ldif/Ldap233LdifParserTests.java +++ b/ldif/ldif-core/src/test/java/org/springframework/ldap/ldif/Ldap233LdifParserTests.java @@ -18,8 +18,8 @@ package org.springframework.ldap.ldif; import java.io.File; import java.io.IOException; +import java.nio.file.Files; -import org.apache.commons.io.FileUtils; import org.junit.Test; import org.springframework.ldap.ldif.parser.LdifParser; @@ -39,7 +39,7 @@ public class Ldap233LdifParserTests { @Test public void ldap233Test() throws IOException { File testFile = File.createTempFile("ldapTest", ".ldif"); - FileUtils.write(testFile, "This is just some random text"); + Files.write(testFile.toPath(), "This is just some random text".getBytes()); LdifParser parser = new LdifParser(testFile); parser.setRecordSpecification(new BasicSchemaSpecification()); diff --git a/odm/build.gradle b/odm/build.gradle index f0df6325..ad3be5be 100644 --- a/odm/build.gradle +++ b/odm/build.gradle @@ -25,8 +25,7 @@ dependencies { testImplementation project(":spring-ldap-test"), "junit:junit", - "jdepend:jdepend", - "commons-io:commons-io" + "jdepend:jdepend" testImplementation "org.apache.directory.server:apacheds-core-entry" testImplementation "org.apache.directory.server:apacheds-core" testImplementation "org.apache.directory.server:apacheds-protocol-ldap" diff --git a/odm/src/test/java/org/springframework/ldap/odm/test/SchemaToJavaTests.java b/odm/src/test/java/org/springframework/ldap/odm/test/SchemaToJavaTests.java index ed72795c..94293fe3 100755 --- a/odm/src/test/java/org/springframework/ldap/odm/test/SchemaToJavaTests.java +++ b/odm/src/test/java/org/springframework/ldap/odm/test/SchemaToJavaTests.java @@ -17,16 +17,19 @@ package org.springframework.ldap.odm.test; import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Iterator; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.naming.ldap.LdapName; -import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -154,7 +157,10 @@ public final class SchemaToJavaTests { final String packageName = "org.springframework.ldap.odm.testclasses"; File tempFile = File.createTempFile("test-odm-syntax-to-class-map", ".txt"); - FileUtils.copyInputStreamToFile(new ClassPathResource("/syntax-to-class-map.txt").getInputStream(), tempFile); + Path from = new ClassPathResource("/syntax-to-class-map.txt").getFile().toPath(); + try (OutputStream to = new FileOutputStream(tempFile)) { + Files.copy(from, to); + } // Add classes dir to class path - needed for compilation System.setProperty("java.class.path", diff --git a/test-support/build.gradle b/test-support/build.gradle index df44d6cd..db86a010 100644 --- a/test-support/build.gradle +++ b/test-support/build.gradle @@ -12,7 +12,6 @@ dependencies { api "org.springframework:spring-test" implementation "com.google.code.typica:typica" - implementation "commons-io:commons-io" optional "org.apache.directory.server:apacheds-core-entry" optional "org.apache.directory.server:apacheds-core" diff --git a/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITests.java b/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITests.java index 6e2060c5..4b4e32d6 100644 --- a/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITests.java +++ b/test/integration-tests-ad/src/test/java/org/springframework/ldap/itest/ad/SchemaToJavaAdITests.java @@ -17,14 +17,17 @@ package org.springframework.ldap.itest.ad; import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.HashMap; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -156,7 +159,10 @@ public final class SchemaToJavaAdITests { final String packageName = "org.springframework.ldap.odm.testclasses"; File tempFile = File.createTempFile("test-odm-syntax-to-class-map", ".txt"); - FileUtils.copyInputStreamToFile(new ClassPathResource("/syntax-to-class-map.txt").getInputStream(), tempFile); + Path from = new ClassPathResource("/syntax-to-class-map.txt").getFile().toPath(); + try (OutputStream to = new FileOutputStream(tempFile)) { + Files.copy(from, to); + } // Add classes dir to class path - needed for compilation System.setProperty("java.class.path",