jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [jclouds] cstamas commented on a change in pull request #82: JCLOUDS-1552: Do not attempt to parse empty payload
Date Fri, 18 Sep 2020 07:20:53 GMT

cstamas commented on a change in pull request #82:
URL: https://github.com/apache/jclouds/pull/82#discussion_r490751367



##########
File path: apis/sts/src/test/java/org/jclouds/aws/util/AWSUtilsTest.java
##########
@@ -88,6 +95,20 @@ public void testNoExceptionParsingTextPlain() {
       assertNull(utils.parseAWSErrorFromContent(command.getCurrentRequest(), response));
    }
 
+   /**
+    * Do not attempt to parse empty payload.
+    */
+   @Test
+   public void testNoExceptionEmptyPayload() {
+      utils.logger = mock(Logger.class);
+      utils.logger.warn(anyObject(Throwable.class), anyString());
+      expectLastCall().andThrow(new IllegalStateException("log spam"));
+      replay(utils.logger);
+      HttpResponse response = HttpResponse.builder().statusCode(NOT_FOUND.getStatusCode()).payload(new
StringPayload("")).build();
+      response.getPayload().getContentMetadata().setContentType("application/unknown");
+      assertNull(utils.parseAWSErrorFromContent(command.getCurrentRequest(), response));
+   }

Review comment:
       +1 will try to get it later afternoon




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message