You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/10/31 17:57:57 UTC

[cxf-fediz] branch master updated: Removing commons io

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

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git


The following commit(s) were added to refs/heads/master by this push:
     new 120bdec  Removing commons io
120bdec is described below

commit 120bdecd72dbdc5a8963d1555a5b1ec0284a504f
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Wed Oct 31 17:57:43 2018 +0000

    Removing commons io
---
 pom.xml                                             |  1 -
 .../fediz/systests/custom/CustomParametersTest.java | 12 +++---------
 .../org/apache/cxf/fediz/systests/idp/IdpTest.java  | 15 +++++++--------
 systests/ldap/pom.xml                               |  6 ------
 .../apache/cxf/fediz/systests/ldap/LDAPTest.java    | 21 +++++----------------
 .../cxf/fediz/systests/oidc/OIDCSpringTest.java     | 12 +++---------
 .../cxf/fediz/systests/oidc/OIDCTomcatTest.java     | 12 +++---------
 .../fediz/systests/samlsso/Tomcat8PluginTest.java   | 12 +++---------
 .../cxf/fediz/systests/common/AbstractTests.java    | 12 +++++++-----
 .../systests/tomcat/AudienceRestrictionTest.java    | 12 +++---------
 .../systests/tomcat/ClientCertificateTest.java      | 12 +++---------
 .../cxf/fediz/systests/tomcat/HolderOfKeyTest.java  | 12 +++---------
 .../cxf/fediz/systests/tomcat/TokenExpiryTest.java  | 12 +++---------
 .../cxf/fediz/systests/tomcat/TomcatTest.java       | 12 +++---------
 .../apache/cxf/fediz/systests/tomcat/WReqTest.java  | 12 +++---------
 15 files changed, 49 insertions(+), 126 deletions(-)

diff --git a/pom.xml b/pom.xml
index 3ba8bd1..cc81b11 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,6 @@
         <bval.version>1.1.2</bval.version>
         <commons.lang.version>3.5</commons.lang.version>
         <commons.logging.version>1.2</commons.logging.version>
-        <commons.io.version>2.5</commons.io.version>
         <commons.validator.version>1.6</commons.validator.version>
         <cxf.version>3.2.7</cxf.version>
         <cxf.build-utils.version>3.4.0</cxf.build-utils.version>
diff --git a/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java b/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
index a713d76..797f870 100644
--- a/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
+++ b/systests/custom/src/test/java/org/apache/cxf/fediz/systests/custom/CustomParametersTest.java
@@ -20,10 +20,9 @@
 package org.apache.cxf.fediz.systests.custom;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.URLEncoder;
+import java.nio.file.Files;
 
 import javax.servlet.ServletException;
 
@@ -38,7 +37,6 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.systests.common.HTTPTestUtils;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
@@ -118,16 +116,12 @@ public class CustomParametersTest {
             // Substitute the IDP port. Necessary if running the test in eclipse where port filtering doesn't seem
             // to work
             File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
-            FileInputStream inputStream = new FileInputStream(f);
-            String content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
+            String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             if (content.contains("idp.https.port")) {
                 content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
 
                 File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
-                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
-                    IOUtils.write(content, outputStream, "UTF-8");
-                }
+                Files.write(f2.toPath(), content.getBytes());
             }
 
             FederationAuthenticator fa = new FederationAuthenticator();
diff --git a/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java b/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
index 3744052..3a57c45 100644
--- a/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
+++ b/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
@@ -21,8 +21,8 @@ package org.apache.cxf.fediz.systests.idp;
 
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.URLEncoder;
+import java.nio.file.Files;
 import java.util.Base64;
 
 import javax.servlet.ServletException;
@@ -45,7 +45,6 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.core.FederationConstants;
 import org.apache.cxf.fediz.core.util.DOMUtils;
 import org.apache.http.auth.AuthScope;
@@ -403,9 +402,9 @@ public class IdpTest {
         String wreply = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName() + "/secure/fedservlet";
         url += "&wreply=" + wreply;
 
-        InputStream is = this.getClass().getClassLoader().getResource("entity_wreq.xml").openStream();
-        String entity = IOUtils.toString(is, "UTF-8");
-        is.close();
+        String currentDir = new File(".").getCanonicalPath();
+        File f = new File(currentDir + "/src/test/resources/entity_wreq.xml");
+        String entity = new String(Files.readAllBytes(f.toPath()), "UTF-8");
         String validWreq =
             "<RequestSecurityToken xmlns=\"http://docs.oasis-open.org/ws-sx/ws-trust/200512\">"
             + "<TokenType>&m;http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</TokenType>"
@@ -443,9 +442,9 @@ public class IdpTest {
         String wreply = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName() + "/secure/fedservlet";
         url += "&wreply=" + wreply;
 
-        InputStream is = this.getClass().getClassLoader().getResource("entity_wreq2.xml").openStream();
-        String entity = IOUtils.toString(is, "UTF-8");
-        is.close();
+        String currentDir = new File(".").getCanonicalPath();
+        File f = new File(currentDir + "/src/test/resources/entity_wreq2.xml");
+        String entity = new String(Files.readAllBytes(f.toPath()), "UTF-8");
         String validWreq =
             "<RequestSecurityToken xmlns=\"http://docs.oasis-open.org/ws-sx/ws-trust/200512\">"
             + "<TokenType>&m;http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0</TokenType>"
diff --git a/systests/ldap/pom.xml b/systests/ldap/pom.xml
index 4414675..46c511e 100644
--- a/systests/ldap/pom.xml
+++ b/systests/ldap/pom.xml
@@ -95,12 +95,6 @@
             <version>${apacheds.version}</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <version>${commons.io.version}</version>
-            <scope>test</scope>
-        </dependency>
 
     </dependencies>
     <build>
diff --git a/systests/ldap/src/test/java/org/apache/cxf/fediz/systests/ldap/LDAPTest.java b/systests/ldap/src/test/java/org/apache/cxf/fediz/systests/ldap/LDAPTest.java
index 264598e..96f10a7 100644
--- a/systests/ldap/src/test/java/org/apache/cxf/fediz/systests/ldap/LDAPTest.java
+++ b/systests/ldap/src/test/java/org/apache/cxf/fediz/systests/ldap/LDAPTest.java
@@ -21,9 +21,8 @@ package org.apache.cxf.fediz.systests.ldap;
 
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.nio.file.Files;
 
 import javax.servlet.ServletException;
 
@@ -32,7 +31,6 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.systests.common.HTTPTestUtils;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
@@ -118,28 +116,19 @@ public class LDAPTest extends AbstractLdapTestUnit {
             // Read in ldap.xml and substitute in the correct port
             File f = new File(basedir + "/src/test/resources/sts/ldap.xml");
 
-            FileInputStream inputStream = new FileInputStream(f);
-            String content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
+            String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             content = content.replaceAll("portno", "" + super.getLdapServer().getPort());
 
             File f2 = new File(basedir + "/target/tomcat/idp/webapps/fediz-idp-sts/WEB-INF/endpoints/ldap.xml");
-            try (FileOutputStream outputStream = new FileOutputStream(f2)) {
-                IOUtils.write(content, outputStream, "UTF-8");
-            }
+            Files.write(f2.toPath(), content.getBytes());
 
             // Read in ldap.jaas and substitute in the correct port
             f = new File(basedir + "/src/test/resources/ldap.jaas");
-
-            inputStream = new FileInputStream(f);
-            content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
+            content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             content = content.replaceAll("portno", "" + super.getLdapServer().getPort());
 
             f2 = new File(basedir + "/target/test-classes/ldap.jaas");
-            try (FileOutputStream outputStream = new FileOutputStream(f2)) {
-                IOUtils.write(content, outputStream, "UTF-8");
-            }
+            Files.write(f2.toPath(), content.getBytes());
 
             portUpdated = true;
         }
diff --git a/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCSpringTest.java b/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCSpringTest.java
index b35da23..b86cd39 100644
--- a/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCSpringTest.java
+++ b/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCSpringTest.java
@@ -21,16 +21,14 @@ package org.apache.cxf.fediz.systests.oidc;
 
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.nio.file.Files;
 
 import javax.servlet.ServletException;
 
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.io.IOUtils;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -104,16 +102,12 @@ public class OIDCSpringTest extends AbstractOIDCTest {
             // Substitute the IDP port. Necessary if running the test in eclipse where port filtering doesn't seem
             // to work
             File f = new File(currentDir + "/src/test/resources/fediz_config_spring.xml");
-            FileInputStream inputStream = new FileInputStream(f);
-            String content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
+            String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             if (content.contains("idp.https.port")) {
                 content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
 
                 File f2 = new File(baseDir + "/test-classes/fediz_config_spring.xml");
-                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
-                    IOUtils.write(content, outputStream, "UTF-8");
-                }
+                Files.write(f2.toPath(), content.getBytes());
             }
         }
 
diff --git a/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTomcatTest.java b/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTomcatTest.java
index 0737c99..81e2c4a 100644
--- a/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTomcatTest.java
+++ b/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTomcatTest.java
@@ -21,9 +21,8 @@ package org.apache.cxf.fediz.systests.oidc;
 
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.nio.file.Files;
 
 import javax.servlet.ServletException;
 
@@ -31,7 +30,6 @@ import org.apache.catalina.Context;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -106,16 +104,12 @@ public class OIDCTomcatTest extends AbstractOIDCTest {
             // Substitute the IDP port. Necessary if running the test in eclipse where port filtering doesn't seem
             // to work
             File f = new File(currentDir + "/src/test/resources/fediz_config_tomcat.xml");
-            FileInputStream inputStream = new FileInputStream(f);
-            String content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
+            String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             if (content.contains("idp.https.port")) {
                 content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
 
                 File f2 = new File(baseDir + "/test-classes/fediz_config_tomcat.xml");
-                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
-                    IOUtils.write(content, outputStream, "UTF-8");
-                }
+                Files.write(f2.toPath(), content.getBytes());
             }
 
             FederationAuthenticator fa = new FederationAuthenticator();
diff --git a/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/Tomcat8PluginTest.java b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/Tomcat8PluginTest.java
index af4605b..e57c910 100644
--- a/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/Tomcat8PluginTest.java
+++ b/systests/samlsso/src/test/java/org/apache/cxf/fediz/systests/samlsso/Tomcat8PluginTest.java
@@ -21,11 +21,10 @@ package org.apache.cxf.fediz.systests.samlsso;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.nio.file.Files;
 
 import javax.servlet.ServletException;
 
@@ -34,7 +33,6 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.io.IOUtils;
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.fediz.systests.common.AbstractTests;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
@@ -125,16 +123,12 @@ public class Tomcat8PluginTest extends AbstractTests {
             // Substitute the IDP port. Necessary if running the test in eclipse where port filtering doesn't seem
             // to work
             File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
-            FileInputStream inputStream = new FileInputStream(f);
-            String content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
+            String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             if (content.contains("idp.https.port")) {
                 content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
 
                 File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
-                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
-                    IOUtils.write(content, outputStream, "UTF-8");
-                }
+                Files.write(f2.toPath(), content.getBytes());
             }
 
             FederationAuthenticator fa = new FederationAuthenticator();
diff --git a/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractTests.java b/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractTests.java
index d78c136..df7b7c6 100644
--- a/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractTests.java
+++ b/systests/tests/src/test/java/org/apache/cxf/fediz/systests/common/AbstractTests.java
@@ -25,6 +25,7 @@ import java.io.InputStreamReader;
 import java.net.URL;
 import java.net.URLEncoder;
 import java.util.ArrayList;
+import java.util.Scanner;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -43,7 +44,6 @@ import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
 import com.gargoylesoftware.htmlunit.util.NameValuePair;
 import com.gargoylesoftware.htmlunit.xml.XmlPage;
 
-import org.apache.commons.io.IOUtils;
 import org.apache.cxf.common.util.Base64Utility;
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.core.FederationConstants;
@@ -759,8 +759,9 @@ public abstract class AbstractTests {
         // Parse the form to get the token (wresult)
         DomNodeList<DomElement> results = idpPage.getElementsByTagName("input");
 
-        String entity =
-            IOUtils.toString(this.getClass().getClassLoader().getResource("entity.xml").openStream(), "UTF-8");
+        Scanner s = 
+            new Scanner(this.getClass().getClassLoader().getResource("entity.xml").openStream()).useDelimiter("\\A");
+        String entity = s.next();
         String reference = "&m;";
 
         for (DomElement result : results) {
@@ -832,8 +833,9 @@ public abstract class AbstractTests {
         // Parse the form to get the token (wresult)
         DomNodeList<DomElement> results = idpPage.getElementsByTagName("input");
 
-        String entity =
-            IOUtils.toString(this.getClass().getClassLoader().getResource("entity2.xml").openStream(), "UTF-8");
+        Scanner s = 
+            new Scanner(this.getClass().getClassLoader().getResource("entity2.xml").openStream()).useDelimiter("\\A");
+        String entity = s.next();
         String reference = "&m;";
 
         for (DomElement result : results) {
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/AudienceRestrictionTest.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/AudienceRestrictionTest.java
index af94947..a5bbcdf 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/AudienceRestrictionTest.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/AudienceRestrictionTest.java
@@ -21,9 +21,8 @@ package org.apache.cxf.fediz.systests.tomcat;
 
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.nio.file.Files;
 
 import javax.servlet.ServletException;
 
@@ -38,7 +37,6 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.UsernamePasswordCredentials;
@@ -113,16 +111,12 @@ public class AudienceRestrictionTest {
             // Substitute the IDP port. Necessary if running the test in eclipse where port filtering doesn't seem
             // to work
             File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
-            FileInputStream inputStream = new FileInputStream(f);
-            String content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
+            String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             if (content.contains("idp.https.port")) {
                 content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
 
                 File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
-                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
-                    IOUtils.write(content, outputStream, "UTF-8");
-                }
+                Files.write(f2.toPath(), content.getBytes());
             }
 
             FederationAuthenticator fa = new FederationAuthenticator();
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/ClientCertificateTest.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/ClientCertificateTest.java
index 1b94d46..86c75a9 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/ClientCertificateTest.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/ClientCertificateTest.java
@@ -20,9 +20,8 @@
 package org.apache.cxf.fediz.systests.tomcat;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.nio.file.Files;
 
 import javax.servlet.ServletException;
 
@@ -31,7 +30,6 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.systests.common.AbstractClientCertTests;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
 import org.junit.AfterClass;
@@ -106,16 +104,12 @@ public class ClientCertificateTest extends AbstractClientCertTests {
             // Substitute the IDP port. Necessary if running the test in eclipse where port filtering doesn't seem
             // to work
             File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
-            FileInputStream inputStream = new FileInputStream(f);
-            String content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
+            String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             if (content.contains("idp.https.port")) {
                 content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
 
                 File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
-                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
-                    IOUtils.write(content, outputStream, "UTF-8");
-                }
+                Files.write(f2.toPath(), content.getBytes());
             }
 
             FederationAuthenticator fa = new FederationAuthenticator();
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/HolderOfKeyTest.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/HolderOfKeyTest.java
index d5b5fc8..5b339b3 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/HolderOfKeyTest.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/HolderOfKeyTest.java
@@ -20,9 +20,8 @@
 package org.apache.cxf.fediz.systests.tomcat;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.nio.file.Files;
 
 import javax.servlet.ServletException;
 
@@ -38,7 +37,6 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
 import org.apache.http.auth.AuthScope;
@@ -115,16 +113,12 @@ public class HolderOfKeyTest {
             // Substitute the IDP port. Necessary if running the test in eclipse where port filtering doesn't seem
             // to work
             File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
-            FileInputStream inputStream = new FileInputStream(f);
-            String content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
+            String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             if (content.contains("idp.https.port")) {
                 content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
 
                 File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
-                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
-                    IOUtils.write(content, outputStream, "UTF-8");
-                }
+                Files.write(f2.toPath(), content.getBytes());
             }
 
             FederationAuthenticator fa = new FederationAuthenticator();
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TokenExpiryTest.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TokenExpiryTest.java
index c1199fc..a6d5016 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TokenExpiryTest.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TokenExpiryTest.java
@@ -21,9 +21,8 @@ package org.apache.cxf.fediz.systests.tomcat;
 
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.nio.file.Files;
 
 import javax.servlet.ServletException;
 
@@ -32,7 +31,6 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.systests.common.AbstractExpiryTests;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
 import org.junit.AfterClass;
@@ -106,16 +104,12 @@ public class TokenExpiryTest extends AbstractExpiryTests {
             // Substitute the IDP port. Necessary if running the test in eclipse where port filtering doesn't seem
             // to work
             File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
-            FileInputStream inputStream = new FileInputStream(f);
-            String content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
+            String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             if (content.contains("idp.https.port")) {
                 content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
 
                 File f2 = new File(baseDir + "/test-classes/fediz_config_exp.xml");
-                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
-                    IOUtils.write(content, outputStream, "UTF-8");
-                }
+                Files.write(f2.toPath(), content.getBytes());
             }
 
             FederationAuthenticator fa = new FederationAuthenticator();
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TomcatTest.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TomcatTest.java
index 659f672..4195717 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TomcatTest.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/TomcatTest.java
@@ -21,9 +21,8 @@ package org.apache.cxf.fediz.systests.tomcat;
 
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.nio.file.Files;
 
 import javax.servlet.ServletException;
 
@@ -32,7 +31,6 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.systests.common.AbstractTests;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
 import org.apache.http.auth.AuthScope;
@@ -115,16 +113,12 @@ public class TomcatTest extends AbstractTests {
             // Substitute the IDP port. Necessary if running the test in eclipse where port filtering doesn't seem
             // to work
             File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
-            FileInputStream inputStream = new FileInputStream(f);
-            String content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
+            String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             if (content.contains("idp.https.port")) {
                 content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
 
                 File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
-                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
-                    IOUtils.write(content, outputStream, "UTF-8");
-                }
+                Files.write(f2.toPath(), content.getBytes());
             }
 
             FederationAuthenticator fa = new FederationAuthenticator();
diff --git a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/WReqTest.java b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/WReqTest.java
index b2752cd..4b2a07e 100644
--- a/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/WReqTest.java
+++ b/systests/tomcat/src/test/java/org/apache/cxf/fediz/systests/tomcat/WReqTest.java
@@ -21,9 +21,8 @@ package org.apache.cxf.fediz.systests.tomcat;
 
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
+import java.nio.file.Files;
 
 import javax.servlet.ServletException;
 
@@ -39,7 +38,6 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
-import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
 import org.apache.http.auth.AuthScope;
@@ -115,16 +113,12 @@ public class WReqTest {
             // Substitute the IDP port. Necessary if running the test in eclipse where port filtering doesn't seem
             // to work
             File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
-            FileInputStream inputStream = new FileInputStream(f);
-            String content = IOUtils.toString(inputStream, "UTF-8");
-            inputStream.close();
+            String content = new String(Files.readAllBytes(f.toPath()), "UTF-8");
             if (content.contains("idp.https.port")) {
                 content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
 
                 File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
-                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
-                    IOUtils.write(content, outputStream, "UTF-8");
-                }
+                Files.write(f2.toPath(), content.getBytes());
             }
 
             FederationAuthenticator fa = new FederationAuthenticator();