From 40fc290721a9ab0c7a815dc60ea965d615860f21 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Thu, 12 Dec 2013 12:46:38 +0100 Subject: Moved hard coded error strings into common.propreties --- .../at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java | 13 +++++++------ .../java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java | 3 +-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'signature-standards/sigs-pades/src') diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java index 5ae0ed76..89293fa1 100644 --- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java +++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESSignerKeystore.java @@ -53,7 +53,7 @@ public class PAdESSignerKeystore implements IPlainSigner { privKey = (PrivateKey) ks.getKey(alias, keypassword.toCharArray()); cert = new X509Certificate(ks.getCertificate(alias).getEncoded()); } catch (Throwable e) { - throw new PdfAsException("Failed to get KeyStore", e); + throw new PdfAsException("error.pdf.sig.02", e); } } @@ -124,6 +124,7 @@ public class PAdESSignerKeystore implements IPlainSigner { si.addSignerInfo(signer1); InputStream dataIs = si.getInputStream(); byte[] buf = new byte[1024]; + @SuppressWarnings("unused") int r; while ((r = dataIs.read(buf)) > 0) ; // skip data @@ -131,15 +132,15 @@ public class PAdESSignerKeystore implements IPlainSigner { return ci.getEncoded(); } catch (NoSuchAlgorithmException e) { - throw new PdfAsSignatureException("Failed to generate Signature", e); + throw new PdfAsSignatureException("error.pdf.sig.01", e); } catch (iaik.cms.CMSException e) { - throw new PdfAsSignatureException("Failed to generate Signature", e); + throw new PdfAsSignatureException("error.pdf.sig.01", e); } catch (IOException e) { - throw new PdfAsSignatureException("Failed to generate Signature", e); + throw new PdfAsSignatureException("error.pdf.sig.01", e); } catch (CertificateException e) { - throw new PdfAsSignatureException("Failed to generate Signature", e); + throw new PdfAsSignatureException("error.pdf.sig.01", e); } catch (CodingException e) { - throw new PdfAsSignatureException("Failed to generate Signature", e); + throw new PdfAsSignatureException("error.pdf.sig.01", e); } } diff --git a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java index 6e79a1a0..52a58d56 100644 --- a/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java +++ b/signature-standards/sigs-pades/src/main/java/at/gv/egiz/pdfas/sigs/pades/PAdESVerifier.java @@ -1,6 +1,5 @@ package at.gv.egiz.pdfas.sigs.pades; -import iaik.security.provider.IAIK; import iaik.x509.X509Certificate; import java.util.ArrayList; @@ -174,7 +173,7 @@ public class PAdESVerifier implements IVerifyFilter { resultList.add(result); } } catch (Throwable e) { - e.printStackTrace(); + throw new PdfAsException("error.pdf.verify.02", e); } return resultList; } -- cgit v1.2.3