Skip to content

Commit

Permalink
Merge pull request #440 from tjtanjin/fix-null-exception
Browse files Browse the repository at this point in the history
Fix: fix a bug where null exception results in looping gif
  • Loading branch information
tjtanjin authored Mar 30, 2021
2 parents f4a6dab + 2ddf6f4 commit 73e84d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public Response callEndpoint() throws RequestException, AbortRequestException {
} else {
throw new AbortRequestException(MESSAGE_CONNECTION_ERROR);
}
} catch (IOException e) {
} catch (Exception e) {
logger.warning(StringUtil.getDetails(e));
throw new RequestException(MESSAGE_GENERAL_ERROR);
} finally {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/seedu/us/among/logic/request/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ private String formatEntity(HttpEntity entity) throws IOException {
String responseEntity = "";
if (entity != null) {
responseEntity = EntityUtils.toString(entity);
if (entity.getContentType().getValue().toLowerCase().contains("application/json")) {
if (entity.getContentType() != null
&& entity.getContentType().getValue().toLowerCase().contains("application/json")) {
responseEntity = JsonUtil.toPrettyPrintJsonString(responseEntity);
}
}
Expand Down

0 comments on commit 73e84d4

Please sign in to comment.