You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by db...@apache.org on 2016/02/22 17:58:32 UTC

ambari git commit: AMBARI-15045. NPE in ambari server log related tez view. (dipayanb)

Repository: ambari
Updated Branches:
  refs/heads/trunk 5366af8ca -> 1dbf7d4ef


AMBARI-15045. NPE in ambari server log related tez view. (dipayanb)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1dbf7d4e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1dbf7d4e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1dbf7d4e

Branch: refs/heads/trunk
Commit: 1dbf7d4ef5d41837f36c961d333506057751a855
Parents: 5366af8
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Mon Feb 22 22:28:05 2016 +0530
Committer: Dipayan Bhowmick <di...@gmail.com>
Committed: Mon Feb 22 22:28:05 2016 +0530

----------------------------------------------------------------------
 .../java/org/apache/ambari/view/tez/utils/ProxyHelper.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1dbf7d4e/contrib/views/tez/src/main/java/org/apache/ambari/view/tez/utils/ProxyHelper.java
----------------------------------------------------------------------
diff --git a/contrib/views/tez/src/main/java/org/apache/ambari/view/tez/utils/ProxyHelper.java b/contrib/views/tez/src/main/java/org/apache/ambari/view/tez/utils/ProxyHelper.java
index a471544..f642193 100644
--- a/contrib/views/tez/src/main/java/org/apache/ambari/view/tez/utils/ProxyHelper.java
+++ b/contrib/views/tez/src/main/java/org/apache/ambari/view/tez/utils/ProxyHelper.java
@@ -54,10 +54,13 @@ public class ProxyHelper {
       URLConnectionProvider provider = viewContext.getURLConnectionProvider();
       HttpURLConnection connection = provider.getConnectionAsCurrent(url, "GET", (String) null, headers);
 
-      if(connection.getResponseCode() != Response.Status.OK.getStatusCode()) {
+      if (!(connection.getResponseCode() >= 200 && connection.getResponseCode() < 300)) {
         LOG.error("Failure in fetching results for the URL: {}. Status: {}", url, connection.getResponseCode());
+        String trace = "";
         inputStream = connection.getErrorStream();
-        String trace = IOUtils.toString(inputStream);
+        if (inputStream != null) {
+          trace = IOUtils.toString(inputStream);
+        }
         throw new ProxyException("Failed to fetch results by the proxy from url: " + url, connection.getResponseCode(), trace);
       }