Skip to content

Commit

Permalink
Merge pull request #139 in OP/openkit-java from bugfix/ONE-44783-fix-…
Browse files Browse the repository at this point in the history
…npe-release-2.0 to release/2.0

* commit 'dbb26864b7d84690432291ac80689439554b49e3':
  Fix possible NPE

GitOrigin-RevId: c073d42f4b89d5c3cda419e40521217434530d5a
  • Loading branch information
stefaneberl authored and openkitdt committed Aug 25, 2020
1 parent 0326778 commit 634da06
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/dynatrace/openkit/protocol/HTTPClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private StatusResponse handleResponse(RequestType requestType, HttpURLConnection
int responseCode = connection.getResponseCode();

String response = responseCode >= 400
? readResponse(connection.getErrorStream()) // error stream is closed in readResponse
? null
: readResponse(connection.getInputStream()); // input stream is closed in readResponse

if (logger.isDebugEnabled()) {
Expand Down Expand Up @@ -363,6 +363,10 @@ int getServerID() {
}

private static String readResponse(InputStream inputStream) throws IOException {
if (inputStream == null) {
return "";
}

StringBuilder responseBuilder = new StringBuilder();

// reading HTTP response
Expand Down

0 comments on commit 634da06

Please sign in to comment.