]> source.dussan.org Git - poi.git/commitdiff
Improve output on invalid HTTP Status Code and ignore another failure to contact...
authorDominik Stadler <centic@apache.org>
Sat, 11 Jun 2016 08:45:41 +0000 (08:45 +0000)
committerDominik Stadler <centic@apache.org>
Sat, 11 Jun 2016 08:45:41 +0000 (08:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1747863 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/poifs/crypt/dsig/services/TSPTimeStampService.java
src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java

index 0478048f7c7f8d37f107fe488612291fc0265256..cc1c4c4a96003fc6b18cabcf326bed334e914517 100644 (file)
@@ -150,8 +150,10 @@ public class TSPTimeStampService implements TimeStampService {
         \r
         int statusCode = huc.getResponseCode();\r
         if (statusCode != 200) {\r
-            LOG.log(POILogger.ERROR, "Error contacting TSP server ", signatureConfig.getTspUrl());\r
-            throw new IOException("Error contacting TSP server " + signatureConfig.getTspUrl());\r
+            LOG.log(POILogger.ERROR, "Error contacting TSP server ", signatureConfig.getTspUrl() +\r
+                    ", had status code " + statusCode + "/" + huc.getResponseMessage());\r
+            throw new IOException("Error contacting TSP server " + signatureConfig.getTspUrl() +\r
+                    ", had status code " + statusCode + "/" + huc.getResponseMessage());\r
         }\r
 \r
         // HTTP input validation\r
index 889b0dd1ab9f45700760aadaee82fbbba604eb7e..eb09fa0ad242d60246d2a9de14dea0b6c1719206 100644 (file)
@@ -389,10 +389,13 @@ public class TestSignatureInfo {
                 throw e;\r
             }\r
             if((e.getCause() instanceof ConnectException) || (e.getCause() instanceof SocketTimeoutException)) {\r
-                assertTrue("Only allowing ConnectException with 'timed out' as message here, but had: " + e,\r
+                Assume.assumeTrue("Only allowing ConnectException with 'timed out' as message here, but had: " + e,\r
                         e.getCause().getMessage().contains("timed out"));\r
+            } else if (e.getCause() instanceof IOException) {\r
+                Assume.assumeTrue("Only allowing IOException with 'Error contacting TSP server' as message here, but had: " + e,\r
+                        e.getCause().getMessage().contains("Error contacting TSP server"));\r
             } else if (e.getCause() instanceof RuntimeException) {\r
-                assertTrue("Only allowing RuntimeException with 'This site is cur' as message here, but had: " + e,\r
+                Assume.assumeTrue("Only allowing RuntimeException with 'This site is cur' as message here, but had: " + e,\r
                         e.getCause().getMessage().contains("This site is cur"));\r
             } else {\r
                 throw e;\r