You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2015/11/18 03:39:15 UTC
[21/30] incubator-kylin git commit: KYLIN-1149 When yarn return an
incomplete job tracking URL, Kylin will fail to get job status
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/db7f8be0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-kylin/tree/db7f8be0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-kylin/diff/db7f8be0
Branch: refs/heads/1.x-HBase1.1.3
Commit: db7f8be0fe2929edd72fff0ea4b0fcfe937816e5
Parents: 2432e2d
Author: shaofengshi <sh...@apache.org>
Authored: Mon Nov 16 16:29:16 2015 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Mon Nov 16 16:29:16 2015 +0800
----------------------------------------------------------------------
.../kylin/job/tools/HadoopStatusGetter.java | 21 ++++++++++++++++++++
1 file changed, 21 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/db7f8be0/job/src/main/java/org/apache/kylin/job/tools/HadoopStatusGetter.java
----------------------------------------------------------------------
diff --git a/job/src/main/java/org/apache/kylin/job/tools/HadoopStatusGetter.java b/job/src/main/java/org/apache/kylin/job/tools/HadoopStatusGetter.java
index 398d15a..0cd4d43 100644
--- a/job/src/main/java/org/apache/kylin/job/tools/HadoopStatusGetter.java
+++ b/job/src/main/java/org/apache/kylin/job/tools/HadoopStatusGetter.java
@@ -19,6 +19,7 @@
package org.apache.kylin.job.tools;
import java.io.IOException;
+import java.net.MalformedURLException;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
@@ -26,6 +27,7 @@ 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;
@@ -84,6 +86,11 @@ public class HadoopStatusGetter {
int cut = s.indexOf("url=");
if (cut >= 0) {
redirect = s.substring(cut + 4);
+
+ if (isValidURL(redirect) == false) {
+ log.info("Get invalid redirect url, skip it: " + redirect);
+ continue;
+ }
}
}
@@ -112,4 +119,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;
+ }
}