You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by ba...@apache.org on 2016/05/23 19:22:11 UTC

falcon git commit: FALCON-1969 Provide server-side error details on CLI, if any

Repository: falcon
Updated Branches:
  refs/heads/master d59ff0d1b -> 004e612d4


FALCON-1969 Provide server-side error details on CLI, if any

Here is a sample CLI output for comparison.

Before:
_[ambari-qasandbox falcon-0.10-SNAPSHOT]$ bin/falcon extension -submit -extensionName hdfs-mirroring -file /tmp/falcon-xml/hdfs-mirror-para.txt
Hadoop is installed, adding hadoop classpath to falcon classpath
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.0.0-169/falcon-0.10-SNAPSHOT/client/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.0.0-169/falcon-0.10-SNAPSHOT/client/lib/falcon-cli-0.10-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.0.0-169/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
ERROR: Internal Server Error;_

After:
_[ambari-qasandbox falcon-0.10-SNAPSHOT]$ bin/falcon extension -submit -extensionName hdfs-mirroring -file /tmp/falcon-xml/hdfs-mirror-para.txt
Hadoop is installed, adding hadoop classpath to falcon classpath
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.0.0-169/falcon-0.10-SNAPSHOT/client/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.0.0-169/falcon-0.10-SNAPSHOT/client/lib/falcon-cli-0.10-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/hdp/2.4.0.0-169/hadoop/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
ERROR: Internal Server Error;**Missing extension property: jobName**_

Author: yzheng-hortonworks <yz...@hortonworks.com>

Reviewers: "Balu Vellanki <ba...@apache.org>"

Closes #148 from yzheng-hortonworks/FALCON-1969 and squashes the following commits:

2956e89 [yzheng-hortonworks] show error details on CLI
7a76b4a [yzheng-hortonworks] FALCON-1969 Provide server-side error details on CLI, if any


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/004e612d
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/004e612d
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/004e612d

Branch: refs/heads/master
Commit: 004e612d48076b0e2022aeff5d01bb4bed4c8094
Parents: d59ff0d
Author: yzheng-hortonworks <yz...@hortonworks.com>
Authored: Mon May 23 12:22:00 2016 -0700
Committer: bvellanki <bv...@hortonworks.com>
Committed: Mon May 23 12:22:00 2016 -0700

----------------------------------------------------------------------
 .../falcon/client/FalconCLIException.java       | 26 +++++++++-----------
 1 file changed, 12 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/004e612d/client/src/main/java/org/apache/falcon/client/FalconCLIException.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/client/FalconCLIException.java b/client/src/main/java/org/apache/falcon/client/FalconCLIException.java
index 29efbae..bd36243 100644
--- a/client/src/main/java/org/apache/falcon/client/FalconCLIException.java
+++ b/client/src/main/java/org/apache/falcon/client/FalconCLIException.java
@@ -47,21 +47,19 @@ public class FalconCLIException extends Exception {
         ClientResponse.Status status = clientResponse.getClientResponseStatus();
         String statusValue = status.toString();
         String message = "";
-        if (status == ClientResponse.Status.BAD_REQUEST) {
-            clientResponse.bufferEntity();
-            InputStream in = clientResponse.getEntityInputStream();
+        clientResponse.bufferEntity();
+        InputStream in = clientResponse.getEntityInputStream();
+        try {
+            in.mark(MB);
+            message = clientResponse.getEntity(APIResult.class).getMessage();
+        } catch (Throwable th) {
+            byte[] data = new byte[MB];
             try {
-                in.mark(MB);
-                message = clientResponse.getEntity(APIResult.class).getMessage();
-            } catch (Throwable th) {
-                byte[] data = new byte[MB];
-                try {
-                    in.reset();
-                    int len = in.read(data);
-                    message = new String(data, 0, len);
-                } catch (IOException e) {
-                    message = e.getMessage();
-                }
+                in.reset();
+                int len = in.read(data);
+                message = new String(data, 0, len);
+            } catch (IOException e) {
+                message = e.getMessage();
             }
         }
         return new FalconCLIException(statusValue + ";" + message);