Source:
public static DbxException unexpectedStatus(HttpRequestor.Response response) throws NetworkIOException, BadResponseException { DbxException networkError; String requestId = getRequestId(response); byte[] body = loadErrorBody(response); String message = parseErrorBody(requestId, response.getStatusCode(), body); switch (response.getStatusCode()) { case 400: networkError = new BadRequestException(requestId, message); break; case 401: networkError = new InvalidAccessTokenException(requestId, message); break; case 429: try { int backoffSecs = Integer.parseInt(getFirstHeader(response, "Retry-After")); networkError = new RateLimitException(requestId, message, backoffSecs, TimeUnit.SECONDS); break; } catch (NumberFormatException ex) { networkError = new BadResponseException(requestId, "Invalid value for HTTP header: \"Retry-After\""); break; } case 500: networkError = new ServerException(requestId, message); break; case 503: String retryAfter = getFirstHeaderMaybe(response, "Retry-After"); try { if (retryAfter != null && !retryAfter.trim().isEmpty()) { int backoffSecs = Integer.parseInt(retryAfter); networkError = new RetryException(requestId, message, backoffSecs, TimeUnit.SECONDS); break; } else { networkError = new RetryException(requestId, message); break; } } catch (NumberFormatException ex) { networkError = new BadResponseException(requestId, "Invalid value for HTTP header: \"Retry-After\""); break; } default: networkError = new BadResponseCodeException( requestId, "unexpected HTTP status code: " + response.getStatusCode() + ": " + message, response.getStatusCode() ); } DbxGlobalCallbackFactory factory = DbxRequestUtil.sharedCallbackFactory; if (factory != null) { DbxNetworkErrorCallback callback = factory.createNetworkErrorCallback(); callback.setNetworkError(networkError); callback.run(); } return networkError; }

Target:
public static DbxException unexpectedStatus(HttpRequestor.Response response) throws NetworkIOException, BadResponseException { DbxException networkError; String requestId = getRequestId(response); byte[] body = loadErrorBody(response); String message = parseErrorBody(requestId, response.getStatusCode(), body); switch (response.getStatusCode()) { case 400: networkError = new BadRequestException(requestId, message); break; case 401: networkError = new InvalidAccessTokenException(requestId, message); break; case 429: try { int backoffSecs = Integer.parseInt(getFirstHeader(response, "Retry-After")); networkError = new RateLimitException(requestId, message, backoffSecs, TimeUnit.SECONDS); break; } catch (NumberFormatException ex) { networkError = new BadResponseException(requestId, "Invalid value for HTTP header: \"Retry-After\""); break; } case 500: networkError = new ServerException(requestId, message); break; case 503: String retryAfter = getFirstHeaderMaybe(response, "Retry-After"); try { if (retryAfter != null && !retryAfter.trim().isEmpty()) { int backoffSecs = Integer.parseInt(retryAfter); networkError = new RetryException(requestId, message, backoffSecs, TimeUnit.SECONDS); break; } else { networkError = new RetryException(requestId, message); break; } } catch (NumberFormatException ex) { networkError = new BadResponseException(requestId, "Invalid value for HTTP header: \"Retry-After\""); break; } default: networkError = new BadResponseCodeException( requestId, "unexpected HTTP status code: " + response.getStatusCode() + ": " + message, response.getStatusCode() ); } DbxGlobalCallbackFactory factory = DbxRequestUtil.sharedCallbackFactory; if (factory != null) { DbxNetworkErrorCallback callback = factory.createNetworkErrorCallback(); callback.onNetworkError(networkError); } return networkError; }