5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-09 06:40:35 +08:00

SQOOP-2667. Sqoop2: RESTiliency: Refactore the one line try-catch statement in InvalidRESTTest

(Jarcec via Hari)
This commit is contained in:
Hari Shreedharan 2015-11-12 15:58:38 -08:00
parent 43c478df5c
commit 60f54b624b

View File

@ -61,7 +61,12 @@ public static abstract class Validator {
public void setConnection(HttpURLConnection connection) throws Exception {
this.connection = connection;
try { this.input = (connection.getInputStream() != null) ? IOUtils.toString(connection.getInputStream()) : ""; } catch(Exception e) { this.input = ""; }
this.input = "";
try {
this.input = (connection.getInputStream() != null) ? IOUtils.toString(connection.getInputStream()) : "";
} catch(Exception e) {
// We're ignoring exception here because that means that request wasn't successful and data are in "error" stream
}
this.error = connection.getErrorStream() != null ? IOUtils.toString(connection.getErrorStream()) : "";
}