Code example for HttpURLConnection

Methods: getErrorStream

0
     */ 
    protected HttpResponse readErrorStream(final HttpURLConnection urlConnection) throws Exception {
        InputStream err = null;
        byte[] responseBody = null;
        try { 
            err = urlConnection.getErrorStream();
            if (err != null) {
                responseBody = requestHandler.readStream(err);
            } 
            return new HttpResponse(urlConnection, responseBody);
        } finally { 
            if (err != null) {
                try { 
                    err.close();
                } catch (Exception e) {
                    // Swallow to avoid dups 
                } 
            } 
        } 
    }