You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2016/06/11 08:45:41 UTC

svn commit: r1747863 - in /poi/trunk/src/ooxml: java/org/apache/poi/poifs/crypt/dsig/services/TSPTimeStampService.java testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java

Author: centic
Date: Sat Jun 11 08:45:41 2016
New Revision: 1747863

URL: http://svn.apache.org/viewvc?rev=1747863&view=rev
Log:
Improve output on invalid HTTP Status Code and ignore another failure to contact the TSP server

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

Modified: poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/services/TSPTimeStampService.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/services/TSPTimeStampService.java?rev=1747863&r1=1747862&r2=1747863&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/services/TSPTimeStampService.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/poifs/crypt/dsig/services/TSPTimeStampService.java Sat Jun 11 08:45:41 2016
@@ -150,8 +150,10 @@ public class TSPTimeStampService impleme
         
         int statusCode = huc.getResponseCode();
         if (statusCode != 200) {
-            LOG.log(POILogger.ERROR, "Error contacting TSP server ", signatureConfig.getTspUrl());
-            throw new IOException("Error contacting TSP server " + signatureConfig.getTspUrl());
+            LOG.log(POILogger.ERROR, "Error contacting TSP server ", signatureConfig.getTspUrl() +
+                    ", had status code " + statusCode + "/" + huc.getResponseMessage());
+            throw new IOException("Error contacting TSP server " + signatureConfig.getTspUrl() +
+                    ", had status code " + statusCode + "/" + huc.getResponseMessage());
         }
 
         // HTTP input validation

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java?rev=1747863&r1=1747862&r2=1747863&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestSignatureInfo.java Sat Jun 11 08:45:41 2016
@@ -389,10 +389,13 @@ public class TestSignatureInfo {
                 throw e;
             }
             if((e.getCause() instanceof ConnectException) || (e.getCause() instanceof SocketTimeoutException)) {
-                assertTrue("Only allowing ConnectException with 'timed out' as message here, but had: " + e,
+                Assume.assumeTrue("Only allowing ConnectException with 'timed out' as message here, but had: " + e,
                         e.getCause().getMessage().contains("timed out"));
+            } else if (e.getCause() instanceof IOException) {
+                Assume.assumeTrue("Only allowing IOException with 'Error contacting TSP server' as message here, but had: " + e,
+                        e.getCause().getMessage().contains("Error contacting TSP server"));
             } else if (e.getCause() instanceof RuntimeException) {
-                assertTrue("Only allowing RuntimeException with 'This site is cur' as message here, but had: " + e,
+                Assume.assumeTrue("Only allowing RuntimeException with 'This site is cur' as message here, but had: " + e,
                         e.getCause().getMessage().contains("This site is cur"));
             } else {
                 throw e;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org