From cc543f79daa5d9e4430f7d1b153261e003ca5a74 Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 1 Jul 2020 14:07:34 +0200 Subject: [PATCH] Streamlined use of org.apache.commons.io.IOUtils --- .../service/remote/download/SEBClientConfigDownload.java | 2 +- .../service/remote/download/SEBExamConfigDownload.java | 2 +- .../remote/download/SEBExamConfigPlaintextDownload.java | 2 +- .../servicelayer/sebconfig/impl/ExamConfigIO.java | 6 +++--- .../servicelayer/sebconfig/impl/PasswordEncryptor.java | 2 +- .../servicelayer/sebconfig/impl/ZipServiceImpl.java | 2 +- .../sebconfig/impl/init/XMLAttributeLoader.java | 8 ++++---- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/download/SEBClientConfigDownload.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/download/SEBClientConfigDownload.java index 72787ff3..a7898eec 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/download/SEBClientConfigDownload.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/download/SEBClientConfigDownload.java @@ -12,7 +12,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import org.apache.tomcat.util.http.fileupload.IOUtils; +import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/download/SEBExamConfigDownload.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/download/SEBExamConfigDownload.java index 9305be12..638322b7 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/download/SEBExamConfigDownload.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/download/SEBExamConfigDownload.java @@ -12,7 +12,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import org.apache.tomcat.util.http.fileupload.IOUtils; +import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Lazy; diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/download/SEBExamConfigPlaintextDownload.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/download/SEBExamConfigPlaintextDownload.java index 3dd5a4be..4c72cc58 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/download/SEBExamConfigPlaintextDownload.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/remote/download/SEBExamConfigPlaintextDownload.java @@ -12,7 +12,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import org.apache.tomcat.util.http.fileupload.IOUtils; +import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Lazy; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ExamConfigIO.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ExamConfigIO.java index 28978b05..1095b124 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ExamConfigIO.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ExamConfigIO.java @@ -27,8 +27,7 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import ch.ethz.seb.sebserver.gbl.util.Cryptor; -import org.apache.tomcat.util.http.fileupload.IOUtils; +import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Lazy; @@ -41,6 +40,7 @@ import ch.ethz.seb.sebserver.gbl.async.AsyncServiceSpringConfig; import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute; import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationValue; import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; +import ch.ethz.seb.sebserver.gbl.util.Cryptor; import ch.ethz.seb.sebserver.gbl.util.Utils; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ConfigurationAttributeDAO; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.ConfigurationDAO; @@ -192,7 +192,7 @@ public class ExamConfigIO { // the SAX handler with a ConfigValue sink that saves the values to DB // and a attribute-name/id mapping function with pre-created mapping final ExamConfigXMLParser examConfigImportHandler = new ExamConfigXMLParser( - cryptor, + this.cryptor, institutionId, configurationId, value -> this.configurationValueDAO diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/PasswordEncryptor.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/PasswordEncryptor.java index 70808bac..adbd4569 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/PasswordEncryptor.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/PasswordEncryptor.java @@ -16,7 +16,7 @@ import java.io.OutputStream; import java.io.SequenceInputStream; import java.util.Set; -import org.apache.tomcat.util.http.fileupload.IOUtils; +import org.apache.commons.io.IOUtils; import org.cryptonode.jncryptor.AES256JNCryptorInputStream; import org.cryptonode.jncryptor.AES256JNCryptorOutputStream; import org.cryptonode.jncryptor.CryptorException; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ZipServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ZipServiceImpl.java index 541bf926..8281fbd2 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ZipServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/ZipServiceImpl.java @@ -14,7 +14,7 @@ import java.io.OutputStream; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; -import org.apache.tomcat.util.http.fileupload.IOUtils; +import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Lazy; diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/init/XMLAttributeLoader.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/init/XMLAttributeLoader.java index 54980441..78028d25 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/init/XMLAttributeLoader.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/sebconfig/impl/init/XMLAttributeLoader.java @@ -17,8 +17,7 @@ import java.util.function.Function; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import ch.ethz.seb.sebserver.gbl.util.Cryptor; -import org.apache.tomcat.util.http.fileupload.IOUtils; +import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Lazy; @@ -28,6 +27,7 @@ import org.springframework.stereotype.Component; import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationAttribute; import ch.ethz.seb.sebserver.gbl.model.sebconfig.ConfigurationValue; import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; +import ch.ethz.seb.sebserver.gbl.util.Cryptor; import ch.ethz.seb.sebserver.gbl.util.Utils; import ch.ethz.seb.sebserver.webservice.servicelayer.sebconfig.impl.ExamConfigXMLParser; @@ -40,7 +40,7 @@ public class XMLAttributeLoader { private final Cryptor cryptor; - public XMLAttributeLoader(Cryptor cryptor) { + public XMLAttributeLoader(final Cryptor cryptor) { this.cryptor = cryptor; } @@ -64,7 +64,7 @@ public class XMLAttributeLoader { final Collection values = new ArrayList<>(); final ExamConfigXMLParser examConfigImportHandler = new ExamConfigXMLParser( - cryptor, + this.cryptor, institutionId, configurationId, values::add,