From 2b70ab18a97dd248d478d985ae602bd7e3a9d320 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Fri, 28 Nov 2014 11:04:46 +0100 Subject: Logging Error Levels adapted --- .../main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java | 10 +++++----- .../pdfas/lib/impl/stamping/CertificateResolver.java | 4 ++-- .../gv/egiz/pdfas/lib/impl/verify/IntegrityVerifier.java | 10 +++++----- .../java/at/gv/egiz/pdfas/lib/util/SignatureUtils.java | 16 ++++++++-------- 4 files changed, 20 insertions(+), 20 deletions(-) (limited to 'pdf-as-lib/src/main/java/at') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java index 8e86364b..fe7f72ab 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java @@ -238,7 +238,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants, return result; } catch (Throwable e) { - logger.error("Failed to create signature [" + e.getMessage() + "]", + logger.warn("Failed to create signature [" + e.getMessage() + "]", e); throw ErrorExtractor.searchPdfAsError(e, status); } finally { @@ -316,7 +316,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants, return request; } catch (Throwable e) { - logger.error("startSign", e); + logger.warn("startSign", e); throw ErrorExtractor.searchPdfAsError(e, status); } } @@ -378,7 +378,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants, request.setNeedSignature(true); } catch (Throwable e) { - logger.error("process", e); + logger.warn("process", e); throw ErrorExtractor.searchPdfAsError(e, status); } } else if (request.needSignature()) { @@ -548,10 +548,10 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants, return signer.generateVisibleSignaturePreview(parameter, iaikCert, resolution, status, requestedSignature); } catch (PdfAsException e) { - logger.error("PDF-AS Exception", e); + logger.warn("PDF-AS Exception", e); throw ErrorExtractor.searchPdfAsError(e, status); } catch (Throwable e) { - logger.error("Throwable Exception", e); + logger.warn("Throwable Exception", e); throw ErrorExtractor.searchPdfAsError(e, status); } diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java index 7012a93a..bff573a4 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/CertificateResolver.java @@ -57,14 +57,14 @@ public class CertificateResolver implements IResolver { Map issuerDNMap = DNUtils.dnToMap(certificate.getIssuerDN().getName()); this.ctx.put("issuer", issuerDNMap); } catch (InvalidNameException e) { - logger.error("Failed to build issuer Map", e); + logger.warn("Failed to build issuer Map", e); } try { Map subjectDNMap = DNUtils.dnToMap(certificate.getSubjectDN().getName()); this.ctx.put("subject", subjectDNMap); } catch (InvalidNameException e) { - logger.error("Failed to build subject Map", e); + logger.warn("Failed to build subject Map", e); } Map iuiMap = new HashMap(); diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/IntegrityVerifier.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/IntegrityVerifier.java index 9142bc68..3b49497b 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/IntegrityVerifier.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/IntegrityVerifier.java @@ -66,7 +66,7 @@ public class IntegrityVerifier implements IVerifier { signedCertificate = signerInfos[0] .getSignedAttribute(ObjectID.signingCertificateV2); if (signedCertificate == null) { - logger.error("Signature ERROR missing signed Signing Certificate: "); + logger.warn("Signature ERROR missing signed Signing Certificate: "); throw new SignatureException("Signature ERROR missing signed Signing Certificate"); } else { @@ -80,12 +80,12 @@ public class IntegrityVerifier implements IVerifier { // OK logger.debug("Found and verified SigningCertificateV2"); } else { - logger.error("Signature ERROR certificate missmatch: "); + logger.warn("Signature ERROR certificate missmatch, misbehaving Sign Backend?"); throw new SignatureException("Signature ERROR certificate missmatch"); } } catch (Throwable e) { - logger.error("Signature ERROR wrong encoding for ESSCertIDv2"); + logger.error("Signature ERROR wrong encoding for ESSCertIDv2, misbehaving Signature Backend?"); throw new SignatureException("Signature ERROR wrong encoding for ESSCertIDv2"); } @@ -99,12 +99,12 @@ public class IntegrityVerifier implements IVerifier { // OK logger.debug("Found and verified SigningCertificate"); } else { - logger.error("Signature ERROR certificate missmatch"); + logger.warn("Signature ERROR certificate missmatch"); throw new SignatureException("Signature ERROR certificate missmatch"); } } catch (Throwable e) { - logger.error("Signature ERROR wrong encoding for ESSCertIDv2"); + logger.error("Signature ERROR wrong encoding for ESSCertIDv2, misbehaving Signature Backend?"); throw new SignatureException("Signature ERROR wrong encoding for ESSCertIDv2", e); } diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/util/SignatureUtils.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/util/SignatureUtils.java index ef5df8b1..6e584f32 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/util/SignatureUtils.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/util/SignatureUtils.java @@ -45,12 +45,12 @@ public class SignatureUtils implements ErrorConstants { // get the signer infos SignerInfo[] signerInfos = signedData.getSignerInfos(); if (signerInfos.length == 0) { - logger.error("Invalid signature (no signer information)"); + logger.warn("Invalid signature (no signer information)"); throw new PDFASError(ERROR_SIG_INVALID_BKU_SIG); } if (signerInfos.length != 1) { - logger.error("Invalid signature (multiple signer information)"); + logger.warn("Invalid signature (multiple signer information)"); throw new PDFASError(ERROR_SIG_INVALID_BKU_SIG); } // verify the signatures @@ -72,7 +72,7 @@ public class SignatureUtils implements ErrorConstants { signedCertificate = signerInfos[0] .getSignedAttribute(ObjectID.signingCertificateV2); if (signedCertificate == null) { - logger.error("Signature ERROR missing signed Signing Certificate: "); + logger.warn("Signature ERROR missing signed Signing Certificate: "); throw new PDFASError(ERROR_SIG_INVALID_BKU_SIG); } else { @@ -84,12 +84,12 @@ public class SignatureUtils implements ErrorConstants { // OK logger.debug("Found and verified SigningCertificateV2"); } else { - logger.error("Signature ERROR certificate missmatch: "); + logger.error("Signature ERROR certificate missmatch, misbehaving Signature Backend?"); throw new PDFASError(ERROR_SIG_INVALID_BKU_SIG); } } catch (Throwable e) { - logger.error("Signature ERROR wrong encoding for ESSCertIDv2:"); + logger.error("Signature ERROR wrong encoding for ESSCertIDv2, misbehaving Signature Backend?"); throw new PDFASError(ERROR_SIG_INVALID_BKU_SIG, e); } @@ -102,12 +102,12 @@ public class SignatureUtils implements ErrorConstants { // OK logger.debug("Found and verified SigningCertificate"); } else { - logger.error("Signature ERROR certificate missmatch"); + logger.warn("Signature ERROR certificate missmatch, misbehaving Signature Backend?"); throw new PDFASError(ERROR_SIG_INVALID_BKU_SIG); } } catch (Throwable e) { - logger.error("Signature ERROR wrong encoding for ESSCertIDv2"); + logger.error("Signature ERROR wrong encoding for ESSCertIDv2, misbehaving Signature Backend?"); throw new PDFASError(ERROR_SIG_INVALID_BKU_SIG, e); } @@ -121,7 +121,7 @@ public class SignatureUtils implements ErrorConstants { } catch (SignatureException ex) { // if the signature is not OK a SignatureException // is thrown - logger.error( + logger.warn( "Signature ERROR from signer: " + signedData.getCertificate( signerInfos[0].getSignerIdentifier()) -- cgit v1.2.3