kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaofeng...@apache.org
Subject incubator-kylin git commit: KYLIN-1149 When yarn return an incomplete job tracking URL, Kylin will fail to get job status
Date Mon, 23 Nov 2015 02:29:00 GMT
Repository: incubator-kylin
Updated Branches:
  refs/heads/2.x-staging 4378ca569 -> 1a1f2bedd


KYLIN-1149 When yarn return an incomplete job tracking URL, Kylin will fail to get job status

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

Branch: refs/heads/2.x-staging
Commit: 1a1f2bedd7d22823f26d8026e318f05cf11b1c72
Parents: 4378ca5
Author: shaofengshi <shaofengshi@apache.org>
Authored: Mon Nov 23 10:28:51 2015 +0800
Committer: shaofengshi <shaofengshi@apache.org>
Committed: Mon Nov 23 10:28:51 2015 +0800

----------------------------------------------------------------------
 .../engine/mr/common/HadoopStatusGetter.java    | 25 ++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/1a1f2bed/engine-mr/src/main/java/org/apache/kylin/engine/mr/common/HadoopStatusGetter.java
----------------------------------------------------------------------
diff --git a/engine-mr/src/main/java/org/apache/kylin/engine/mr/common/HadoopStatusGetter.java
b/engine-mr/src/main/java/org/apache/kylin/engine/mr/common/HadoopStatusGetter.java
index 3a79a3d..7bab771 100644
--- a/engine-mr/src/main/java/org/apache/kylin/engine/mr/common/HadoopStatusGetter.java
+++ b/engine-mr/src/main/java/org/apache/kylin/engine/mr/common/HadoopStatusGetter.java
@@ -18,14 +18,13 @@
 
 package org.apache.kylin.engine.mr.common;
 
-import java.io.IOException;
-
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.protocol.Protocol;
 import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
+import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
@@ -34,6 +33,9 @@ import org.codehaus.jackson.map.ObjectMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.IOException;
+import java.net.MalformedURLException;
+
 /**
  */
 public class HadoopStatusGetter {
@@ -83,6 +85,11 @@ public class HadoopStatusGetter {
                     int cut = s.indexOf("url=");
                     if (cut >= 0) {
                         redirect = s.substring(cut + 4);
+
+                        if (isValidURL(redirect) == false) {
+                            logger.info("Get invalid redirect url, skip it: " + redirect);
+                            continue;
+                        }
                     }
                 }
 
@@ -111,4 +118,18 @@ public class HadoopStatusGetter {
         }
     }
 
+    private static boolean isValidURL(String value) {
+        if (StringUtils.isNotEmpty(value)) {
+            java.net.URL url;
+            try {
+                url = new java.net.URL(value);
+            } catch (MalformedURLException var5) {
+                return false;
+            }
+
+            return StringUtils.isNotEmpty(url.getProtocol()) && StringUtils.isNotEmpty(url.getHost());
+        }
+
+        return false;
+    }
 }


Mime
View raw message