mirror of
https://github.com/apache/jclouds.git
synced 2025-02-16 06:56:45 +00:00
cleaned exception handling
This commit is contained in:
parent
d0a5278ca0
commit
cfb180f638
@ -25,7 +25,6 @@ import static com.google.common.collect.Iterables.getLast;
|
|||||||
import static com.google.common.io.ByteStreams.toByteArray;
|
import static com.google.common.io.ByteStreams.toByteArray;
|
||||||
import static com.google.common.io.Closeables.closeQuietly;
|
import static com.google.common.io.Closeables.closeQuietly;
|
||||||
import static org.jclouds.io.Payloads.newInputStreamPayload;
|
import static org.jclouds.io.Payloads.newInputStreamPayload;
|
||||||
import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -107,15 +106,12 @@ public class JavaUrlHttpCommandExecutorService extends BaseHttpCommandExecutorSe
|
|||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
try {
|
try {
|
||||||
in = consumeOnClose(connection.getInputStream());
|
in = consumeOnClose(connection.getInputStream());
|
||||||
} catch (Exception e) {
|
} catch (IOException e) {
|
||||||
IOException ioe = getFirstThrowableOfType(e, IOException.class);
|
in = bufferAndCloseStream(connection.getErrorStream());
|
||||||
if (ioe != null) {
|
} catch (RuntimeException e) {
|
||||||
in = bufferAndCloseStream(connection.getErrorStream());
|
closeQuietly(in);
|
||||||
} else {
|
propagate(e);
|
||||||
closeQuietly(in);
|
assert false : "should have propagated exception";
|
||||||
propagate(e);
|
|
||||||
assert false : "should have propagated exception";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int responseCode = connection.getResponseCode();
|
int responseCode = connection.getResponseCode();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user