Fix IOException when the HTTP response indicates that an error occurred, as per http://developer.android.com/reference/java/net/HttpURLConnection.html