/** * Reads the response from the input stream and throws in case of errors. * * @param is * stream to read from * * @throws IOException * if the response is an error or reading the response failed */ private static void receiveAndCheckGetResponse(InputStream is) throws IOException { int response = is.read(); if (response < 0) { throw new EOFException("Premature end of response"); } if (response == RETURN_ERROR) { Throwable cause = readExceptionFromStream(is); throw new IOException("Server side error: " + cause.getMessage(), cause); } else if (response != RETURN_OKAY) { throw new IOException("Unrecognized response"); } }
/** * Reads the response from the input stream and throws in case of errors. * * @param is * stream to read from * * @throws IOException * if the response is an error or reading the response failed */ private static void receiveAndCheckGetResponse(InputStream is) throws IOException { int response = is.read(); if (response < 0) { throw new EOFException("Premature end of response"); } if (response == RETURN_ERROR) { Throwable cause = readExceptionFromStream(is); throw new IOException("Server side error: " + cause.getMessage(), cause); } else if (response != RETURN_OKAY) { throw new IOException("Unrecognized response"); } }
/** * Reads the response from the input stream and throws in case of errors. * * @param is * stream to read from * * @throws IOException * if the response is an error or reading the response failed */ private static void receiveAndCheckGetResponse(InputStream is) throws IOException { int response = is.read(); if (response < 0) { throw new EOFException("Premature end of response"); } if (response == RETURN_ERROR) { Throwable cause = readExceptionFromStream(is); throw new IOException("Server side error: " + cause.getMessage(), cause); } else if (response != RETURN_OKAY) { throw new IOException("Unrecognized response"); } }
Throwable cause = BlobUtils.readExceptionFromStream(is); throw new IOException("Server side error: " + cause.getMessage(), cause);
Throwable cause = BlobUtils.readExceptionFromStream(is); throw new IOException("Server side error: " + cause.getMessage(), cause);
Throwable cause = BlobUtils.readExceptionFromStream(is); throw new IOException("Server side error: " + cause.getMessage(), cause);