From: Andreas Beeker Date: Sat, 22 Nov 2014 01:47:48 +0000 (+0000) Subject: Don't swallow exceptions on validation X-Git-Tag: REL_3_11_FINAL~28 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4b583b4339bcd3cde8ee32502bce6a6d579e1973;p=poi.git Don't swallow exceptions on validation git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1641025 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java b/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java index bf9dae94f5..c6efe6077d 100644 --- a/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java +++ b/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java @@ -217,7 +217,10 @@ public class SignatureInfo implements SignatureConfigurable { /** * @return true, when the xml signature is valid, false otherwise + * + * @throws EncryptedDocumentException if the signature can't be extracted or if its malformed */ + @SuppressWarnings("unchecked") public boolean validate() { KeyInfoKeySelector keySelector = new KeyInfoKeySelector(); try { @@ -259,8 +262,9 @@ public class SignatureInfo implements SignatureConfigurable { return valid; } catch (Exception e) { - LOG.log(POILogger.ERROR, "error in marshalling and validating the signature", e); - return false; + String s = "error in marshalling and validating the signature"; + LOG.log(POILogger.ERROR, s, e); + throw new EncryptedDocumentException(s, e); } } }