]> source.dussan.org Git - poi.git/commitdiff
Don't swallow exceptions on validation
authorAndreas Beeker <kiwiwings@apache.org>
Sat, 22 Nov 2014 01:47:48 +0000 (01:47 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Sat, 22 Nov 2014 01:47:48 +0000 (01:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1641025 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/poifs/crypt/dsig/SignatureInfo.java

index bf9dae94f53c0f19f307dd168ffae1b5ab3f150b..c6efe6077d72970b749b0d537d2da644c23c9698 100644 (file)
@@ -217,7 +217,10 @@ public class SignatureInfo implements SignatureConfigurable {
         \r
         /**\r
          * @return true, when the xml signature is valid, false otherwise\r
+         * \r
+         * @throws EncryptedDocumentException if the signature can't be extracted or if its malformed\r
          */\r
+        @SuppressWarnings("unchecked")\r
         public boolean validate() {\r
             KeyInfoKeySelector keySelector = new KeyInfoKeySelector();\r
             try {\r
@@ -259,8 +262,9 @@ public class SignatureInfo implements SignatureConfigurable {
                 \r
                 return valid;\r
             } catch (Exception e) {\r
-                LOG.log(POILogger.ERROR, "error in marshalling and validating the signature", e);\r
-                return false;\r
+                String s = "error in marshalling and validating the signature";\r
+                LOG.log(POILogger.ERROR, s, e);\r
+                throw new EncryptedDocumentException(s, e);\r
             }\r
         }\r
     }\r