[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Exception HttpResponseException (2.0.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.0.0 (latest)](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpResponseException)\n- [1.47.1](/java/docs/reference/google-http-client/1.47.1/com.google.api.client.http.HttpResponseException)\n- [1.46.3](/java/docs/reference/google-http-client/1.46.3/com.google.api.client.http.HttpResponseException)\n- [1.45.3](/java/docs/reference/google-http-client/1.45.3/com.google.api.client.http.HttpResponseException)\n- [1.44.2](/java/docs/reference/google-http-client/1.44.2/com.google.api.client.http.HttpResponseException)\n- [1.43.2](/java/docs/reference/google-http-client/1.43.2/com.google.api.client.http.HttpResponseException)\n- [1.42.3](/java/docs/reference/google-http-client/1.42.3/com.google.api.client.http.HttpResponseException)\n- [1.41.8](/java/docs/reference/google-http-client/1.41.8/com.google.api.client.http.HttpResponseException) \n\n public class HttpResponseException extends IOException\n\nException thrown when an error status code is detected in an HTTP response.\n\nImplementation is not thread safe. \n\nInherited Members\n-----------------\n\n[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) \n[Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) \n[Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) \n[Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) \n[Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) \n[Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) \n[Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) \n[Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) \n[Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) \n[Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-) \n[Throwable.addSuppressed(Throwable)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#addSuppressed-java.lang.Throwable-) \n[Throwable.fillInStackTrace()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#fillInStackTrace--) \n[Throwable.getCause()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getCause--) \n[Throwable.getLocalizedMessage()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getLocalizedMessage--) \n[Throwable.getMessage()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getMessage--) \n[Throwable.getStackTrace()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getStackTrace--) \n[Throwable.getSuppressed()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getSuppressed--) \n[Throwable.initCause(Throwable)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#initCause-java.lang.Throwable-) \n[Throwable.printStackTrace()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace--) \n[Throwable.printStackTrace(PrintStream)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace-java.io.PrintStream-) \n[Throwable.printStackTrace(PrintWriter)](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace-java.io.PrintWriter-) \n[Throwable.setStackTrace(StackTraceElement\\[\\])](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#setStackTrace-java.lang.StackTraceElement[]-) \n[Throwable.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#toString--)\n\nStatic Methods\n--------------\n\n### computeMessageBuffer(HttpResponse response)\n\n public static StringBuilder computeMessageBuffer(HttpResponse response)\n\nReturns an exception message string builder to use for the given HTTP response.\n\nConstructors\n------------\n\n### HttpResponseException(HttpResponse response)\n\n public HttpResponseException(HttpResponse response)\n\nConstructor that constructs a detail message from the given HTTP response that includes the\nstatus code, status message and HTTP response content.\n\nCallers of this constructor should call [HttpResponse#disconnect](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpResponse#com_google_api_client_http_HttpResponse_disconnect_) after [HttpResponseException](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpResponseException) is instantiated. Example usage:\n\ntry {\nthrow new HttpResponseException(response);\n} finally {\nresponse.disconnect();\n}\n\n### HttpResponseException(HttpResponseException.Builder builder)\n\n protected HttpResponseException(HttpResponseException.Builder builder)\n\nMethods\n-------\n\n### getAttemptCount()\n\n public final int getAttemptCount()\n\nReturns the attempt count\n\n### getContent()\n\n public final String getContent()\n\nReturns the HTTP response content or `null` for none.\n\n### getHeaders()\n\n public HttpHeaders getHeaders()\n\nReturns the HTTP response headers.\n\n### getStatusCode()\n\n public final int getStatusCode()\n\nReturns the HTTP status code or `0` for none.\n\n### getStatusMessage()\n\n public final String getStatusMessage()\n\nReturns the HTTP status message or `null` for none.\n\n### isSuccessStatusCode()\n\n public final boolean isSuccessStatusCode()\n\nReturns whether received a successful HTTP status code `\u003e= 200 && \u003c 300` (see [#getStatusCode()](/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpResponseException#com_google_api_client_http_HttpResponseException_getStatusCode__))."]]