From 7f66428916800f37fcc3ea67310d2ef73eb2fa38 Mon Sep 17 00:00:00 2001 From: Emina Ahmetovic Date: Thu, 24 Sep 2020 09:46:48 +0200 Subject: update libraries, use StringUtils --- .../src/main/java/at/gv/egiz/pdfas/cli/Main.java | 1 - pdf-as-lib/build.gradle | 2 +- .../lib/impl/placeholder/PlaceholderFilter.java | 11 +-- pdf-as-lib/src/main/resources/config/config.zip | Bin 1277230 -> 1276558 bytes pdf-as-pdfbox-2/build.gradle | 2 +- .../pdfbox2/configuration/ProfileValidator.java | 31 ++++---- pdf-as-web-client/build.gradle | 2 +- .../at/gv/egiz/pdfas/web/helper/PdfAsHelper.java | 80 ++++++++------------- .../pdfas/web/helper/PdfAsParameterExtractor.java | 1 - signature-standards/sigs-pades/build.gradle | 2 +- .../sigs-pkcs7detached/build.gradle | 2 +- 11 files changed, 55 insertions(+), 79 deletions(-) diff --git a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java index 32f18867..c2d35c40 100644 --- a/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java +++ b/pdf-as-cli/src/main/java/at/gv/egiz/pdfas/cli/Main.java @@ -33,7 +33,6 @@ import java.util.UUID; import javax.activation.DataSource; -import at.gv.egiz.pdfas.lib.api.*; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.GnuParser; diff --git a/pdf-as-lib/build.gradle b/pdf-as-lib/build.gradle index 2e000ef9..35f82172 100644 --- a/pdf-as-lib/build.gradle +++ b/pdf-as-lib/build.gradle @@ -67,7 +67,7 @@ dependencies { compile group: 'org.glassfish.jaxb', name: 'jaxb-runtime', version: '2.4.0-b180830.0438' - compile 'org.apache.commons:commons-collections4:4.0' + compile 'org.apache.commons:commons-collections4:4.4' compile group: 'ognl', name: 'ognl', version: '3.0.8' compile files('libs/iaik_eccelerate_cms.jar') compile files('libs/iaik_eccelerate.jar') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java index 5919ee5d..500b9e24 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/placeholder/PlaceholderFilter.java @@ -32,6 +32,7 @@ import at.gv.egiz.pdfas.common.settings.ISettings; import at.gv.egiz.pdfas.lib.api.IConfigurationConstants; import at.gv.egiz.pdfas.lib.impl.configuration.PlaceholderWebConfiguration; import at.gv.egiz.pdfas.lib.impl.status.OperationStatus; +import org.apache.commons.lang3.StringUtils; public class PlaceholderFilter implements IConfigurationConstants, PlaceholderExtractorConstants { @@ -45,18 +46,18 @@ public class PlaceholderFilter implements IConfigurationConstants, if (status.getPlaceholderConfiguration().isGlobalPlaceholderEnabled()) { PlaceholderExtractor extractor = status.getBackend().getPlaceholderExtractor(); - if(signatureLocation!=null) { + if(StringUtils.isNotEmpty(signatureLocation)) { placeholderID = signatureLocation; } else { placeholderID = PlaceholderWebConfiguration.getValue(PLACEHOLDER_WEB_ID); - if(placeholderID == null) { + if(StringUtils.isEmpty(placeholderID)) { placeholderID = settings.getValue(PLACEHOLDER_ID); } } String placeholderModeString = settings.getValue(PLACEHOLDER_MODE); int placeholderMode = PLACEHOLDER_MATCH_MODE_MODERATE; - if (placeholderModeString != null) { + if (StringUtils.isNotEmpty(placeholderModeString)) { try { placeholderMode = Integer.parseInt(placeholderModeString); if (placeholderMode < PLACEHOLDER_MODE_MIN @@ -78,11 +79,11 @@ public class PlaceholderFilter implements IConfigurationConstants, int placeholderMode = PLACEHOLDER_MATCH_MODE_SORTED; placeholderID = status.getPlaceholderConfiguration().getProfilePlaceholderID(status.getRequestedSignature().getSignatureProfileID()); - if(placeholderID != null) { + if(StringUtils.isNotEmpty(placeholderID)) { placeholderMode = PLACEHOLDER_MATCH_MODE_MODERATE; } String placeholderModeString = settings.getValue(PLACEHOLDER_MODE); - if (placeholderModeString != null) { + if (StringUtils.isNotEmpty(placeholderModeString)) { try { placeholderMode = Integer.parseInt(placeholderModeString); if (placeholderMode < PLACEHOLDER_MODE_MIN diff --git a/pdf-as-lib/src/main/resources/config/config.zip b/pdf-as-lib/src/main/resources/config/config.zip index 666b61a6..ebfeee02 100644 Binary files a/pdf-as-lib/src/main/resources/config/config.zip and b/pdf-as-lib/src/main/resources/config/config.zip differ diff --git a/pdf-as-pdfbox-2/build.gradle b/pdf-as-pdfbox-2/build.gradle index 6f885190..5f05277b 100644 --- a/pdf-as-pdfbox-2/build.gradle +++ b/pdf-as-pdfbox-2/build.gradle @@ -40,7 +40,7 @@ dependencies { compile group: 'ognl', name: 'ognl', version: '3.0.6' testCompile group: 'junit', name: 'junit', version: '4.+' compile group: 'com.github.jai-imageio', name: 'jai-imageio-jpeg2000', version: '1.3.0' - compile group: 'com.github.jai-imageio', name: 'jai-imageio-core', version: '1.3.1' + compile group: 'com.github.jai-imageio', name: 'jai-imageio-core', version: '1.4.0' compile group: 'com.levigo.jbig2', name: 'levigo-jbig2-imageio', version: '1.6.5' compile group: 'javax.activation', name: 'activation', version: '1.1.1' diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/configuration/ProfileValidator.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/configuration/ProfileValidator.java index dcbe7122..1c57605b 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/configuration/ProfileValidator.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/configuration/ProfileValidator.java @@ -1,8 +1,21 @@ package at.gv.egiz.pdfas.lib.impl.pdfbox2.configuration; +import at.gv.egiz.pdfas.common.exceptions.PdfAsSettingsValidationException; +import at.gv.egiz.pdfas.common.settings.ISettings; +import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings; +import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource; +import at.gv.egiz.pdfas.lib.configuration.ConfigurationValidator; +import at.gv.egiz.pdfas.lib.impl.pdfbox2.PDFBOXObject; +import at.gv.egiz.pdfas.lib.impl.status.ICertificateProvider; +import at.gv.egiz.pdfas.lib.impl.status.OperationStatus; import iaik.asn1.ObjectID; import iaik.asn1.structures.Name; import iaik.x509.X509Certificate; +import org.apache.pdfbox.pdmodel.PDDocument; +import org.apache.pdfbox.pdmodel.PDPage; +import org.apache.pdfbox.pdmodel.common.PDRectangle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -12,24 +25,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; -import org.apache.pdfbox.pdmodel.PDDocument; -import org.apache.pdfbox.pdmodel.PDPage; -import org.apache.pdfbox.pdmodel.common.PDRectangle; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.gv.egiz.pdfas.common.exceptions.PdfAsSettingsValidationException; -import at.gv.egiz.pdfas.common.settings.ISettings; -import at.gv.egiz.pdfas.common.settings.SignatureProfileSettings; -import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource; -import at.gv.egiz.pdfas.lib.configuration.ConfigurationValidator; -import at.gv.egiz.pdfas.lib.impl.pdfbox2.PDFBOXObject; -import at.gv.egiz.pdfas.lib.impl.stamping.TableFactory; -import at.gv.egiz.pdfas.lib.impl.stamping.pdfbox2.PDFBoxTable; -import at.gv.egiz.pdfas.lib.impl.status.ICertificateProvider; -import at.gv.egiz.pdfas.lib.impl.status.OperationStatus; -import at.knowcenter.wag.egov.egiz.table.Table; - public class ProfileValidator implements ConfigurationValidator{ private static final String NAME = "PDFBOX_2_PROFILE_VALIDATOR"; diff --git a/pdf-as-web-client/build.gradle b/pdf-as-web-client/build.gradle index b820ede0..961c4c48 100644 --- a/pdf-as-web-client/build.gradle +++ b/pdf-as-web-client/build.gradle @@ -13,7 +13,7 @@ repositories { } dependencies { - compile 'org.apache.commons:commons-collections4:4.+' + compile 'org.apache.commons:commons-collections4:4.4' compile project (':pdf-as-common') testCompile group: 'junit', name: 'junit', version: '4.+' } diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java index 8f8850ed..11ee4790 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java @@ -23,60 +23,13 @@ ******************************************************************************/ package at.gv.egiz.pdfas.web.helper; -import iaik.x509.X509Certificate; - -import java.awt.Image; -import java.awt.image.RenderedImage; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.net.URL; -import java.net.URLEncoder; -import java.security.cert.CertificateException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import javax.imageio.ImageIO; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.xml.bind.JAXBElement; -import javax.xml.ws.WebServiceException; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringEscapeUtils; -import org.apache.commons.lang3.StringUtils; -import org.apache.http.entity.ContentType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; - import at.gv.egiz.pdfas.api.ws.PDFASSignParameters; import at.gv.egiz.pdfas.api.ws.PDFASSignParameters.Connector; import at.gv.egiz.pdfas.api.ws.PDFASSignResponse; import at.gv.egiz.pdfas.api.ws.PDFASVerificationResponse; import at.gv.egiz.pdfas.common.exceptions.PDFASError; import at.gv.egiz.pdfas.common.utils.PDFUtils; -import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource; -import at.gv.egiz.pdfas.lib.api.Configuration; -import at.gv.egiz.pdfas.lib.api.IConfigurationConstants; -import at.gv.egiz.pdfas.lib.api.PdfAs; -import at.gv.egiz.pdfas.lib.api.PdfAsFactory; -import at.gv.egiz.pdfas.lib.api.StatusRequest; +import at.gv.egiz.pdfas.lib.api.*; import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; import at.gv.egiz.pdfas.lib.api.sign.SignParameter; import at.gv.egiz.pdfas.lib.api.sign.SignResult; @@ -92,7 +45,6 @@ import at.gv.egiz.pdfas.web.servlets.UIEntryPointServlet; import at.gv.egiz.pdfas.web.sl20.JsonSecurityUtils; import at.gv.egiz.pdfas.web.sl20.SL20HttpBindingUtils; import at.gv.egiz.pdfas.web.stats.StatisticEvent; -import at.gv.egiz.sl.schema.CreateCMSSignatureResponseType; import at.gv.egiz.sl.schema.InfoboxAssocArrayPairType; import at.gv.egiz.sl.schema.InfoboxReadRequestType; import at.gv.egiz.sl.schema.InfoboxReadResponseType; @@ -108,6 +60,36 @@ import at.gv.egiz.sl20.exceptions.SLCommandoParserException; import at.gv.egiz.sl20.utils.SL20Constants; import at.gv.egiz.sl20.utils.SL20JSONBuilderUtils; import at.gv.egiz.sl20.utils.SL20JSONExtractorUtils; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import iaik.x509.X509Certificate; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.entity.ContentType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.imageio.ImageIO; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import javax.xml.bind.JAXBElement; +import javax.xml.ws.WebServiceException; +import java.awt.*; +import java.awt.image.RenderedImage; +import java.io.*; +import java.net.URL; +import java.net.URLEncoder; +import java.security.cert.CertificateException; +import java.util.*; +import java.util.List; public class PdfAsHelper { diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java index b50b7dbd..5415b233 100644 --- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java +++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsParameterExtractor.java @@ -76,7 +76,6 @@ public class PdfAsParameterExtractor { public static final String PARAM_QRCODE_CONTENT = "qrcontent"; - public static String getConnector(HttpServletRequest request) { String connector = (String)request.getAttribute(PARAM_CONNECTOR); if(connector != null) { diff --git a/signature-standards/sigs-pades/build.gradle b/signature-standards/sigs-pades/build.gradle index c67edbca..62fb154f 100644 --- a/signature-standards/sigs-pades/build.gradle +++ b/signature-standards/sigs-pades/build.gradle @@ -23,7 +23,7 @@ releases.dependsOn sourcesJar dependencies { compile project (':pdf-as-lib') compile project (':pdf-as-common') - compile 'org.apache.commons:commons-collections4:4.0' + compile 'org.apache.commons:commons-collections4:4.4' testCompile group: 'junit', name: 'junit', version: '4.+' } diff --git a/signature-standards/sigs-pkcs7detached/build.gradle b/signature-standards/sigs-pkcs7detached/build.gradle index 197c6c07..3da05ccc 100644 --- a/signature-standards/sigs-pkcs7detached/build.gradle +++ b/signature-standards/sigs-pkcs7detached/build.gradle @@ -23,7 +23,7 @@ releases.dependsOn sourcesJar dependencies { compile project (':pdf-as-lib') compile project (':pdf-as-common') - compile 'org.apache.commons:commons-collections4:4.0' + compile 'org.apache.commons:commons-collections4:4.4' testCompile group: 'junit', name: 'junit', version: '4.+' } -- cgit v1.2.3