You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by hs...@apache.org on 2015/11/13 00:59:17 UTC

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

Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 43c478df5 -> 60f54b624


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

(Jarcec via Hari)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/60f54b62
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/60f54b62
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/60f54b62

Branch: refs/heads/sqoop2
Commit: 60f54b624b3ebffb10dfa6f5de58b6f42ecedff6
Parents: 43c478d
Author: Hari Shreedharan <hs...@apache.org>
Authored: Thu Nov 12 15:58:38 2015 -0800
Committer: Hari Shreedharan <hs...@apache.org>
Committed: Thu Nov 12 15:58:38 2015 -0800

----------------------------------------------------------------------
 .../apache/sqoop/integration/server/InvalidRESTCallsTest.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/60f54b62/test/src/test/java/org/apache/sqoop/integration/server/InvalidRESTCallsTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/server/InvalidRESTCallsTest.java b/test/src/test/java/org/apache/sqoop/integration/server/InvalidRESTCallsTest.java
index 14b7843..614895d 100644
--- a/test/src/test/java/org/apache/sqoop/integration/server/InvalidRESTCallsTest.java
+++ b/test/src/test/java/org/apache/sqoop/integration/server/InvalidRESTCallsTest.java
@@ -61,7 +61,12 @@ public class InvalidRESTCallsTest extends SqoopTestCase {
     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()) : "";
     }