Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions app/src/main/java/com/nextcloud/android/sso/InputStreamBinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,29 +422,24 @@ private Response processRequestV2(final NextcloudRequest request, final InputStr
client.setFollowRedirects(request.isFollowRedirects());
int status = client.executeMethod(method);

// handle “Not Modified” responses
if (status == 304) {
Log_OC.i(TAG, "Received status " + status + " not modified");
method.releaseConnection();
return new Response();
}

// Check if status code is 2xx --> https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#2xx_Success
if (status >= HTTP_STATUS_CODE_OK && status < HTTP_STATUS_CODE_MULTIPLE_CHOICES) {
return new Response(method);
}
} else {
InputStream inputStream = method.getResponseBodyAsStream();
String total = "No response body";

InputStream inputStream = method.getResponseBodyAsStream();
String total = "No response body";
// If response body is available
if (inputStream != null) {
total = inputStreamToString(inputStream);
Log_OC.e(TAG, total);
}

if (inputStream != null) {
total = inputStreamToString(inputStream);
Log_OC.e(TAG, total);
method.releaseConnection();
throw new IllegalStateException(EXCEPTION_HTTP_REQUEST_FAILED,
new IllegalStateException(String.valueOf(status),
new IllegalStateException(total)));
}

method.releaseConnection();
throw new IllegalStateException(EXCEPTION_HTTP_REQUEST_FAILED,
new IllegalStateException(String.valueOf(status),
new IllegalStateException(total)));
}

private boolean isValid(NextcloudRequest request) {
Expand Down
Loading