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 2016/12/08 08:57:47 UTC
kylin git commit: KYLIN-2209 fix potential NPE
Repository: kylin
Updated Branches:
refs/heads/master c0b87039e -> c94d21829
KYLIN-2209 fix potential NPE
Signed-off-by: Li Yang <li...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/c94d2182
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/c94d2182
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/c94d2182
Branch: refs/heads/master
Commit: c94d2182904b0f1174eaba2504ce242b7d509168
Parents: c0b8703
Author: etherge <et...@163.com>
Authored: Mon Nov 21 22:23:28 2016 +0800
Committer: Li Yang <li...@apache.org>
Committed: Thu Dec 8 16:57:38 2016 +0800
----------------------------------------------------------------------
.../kylin/rest/controller/StreamingController.java | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/c94d2182/server-base/src/main/java/org/apache/kylin/rest/controller/StreamingController.java
----------------------------------------------------------------------
diff --git a/server-base/src/main/java/org/apache/kylin/rest/controller/StreamingController.java b/server-base/src/main/java/org/apache/kylin/rest/controller/StreamingController.java
index a5fb874..e04ebc8 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/controller/StreamingController.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/controller/StreamingController.java
@@ -26,9 +26,9 @@ import org.apache.commons.lang.StringUtils;
import org.apache.kylin.common.KylinConfig;
import org.apache.kylin.common.util.JsonUtil;
import org.apache.kylin.engine.mr.HadoopUtil;
-import org.apache.kylin.metadata.streaming.StreamingConfig;
import org.apache.kylin.metadata.MetadataManager;
import org.apache.kylin.metadata.model.TableDesc;
+import org.apache.kylin.metadata.streaming.StreamingConfig;
import org.apache.kylin.rest.exception.BadRequestException;
import org.apache.kylin.rest.exception.ForbiddenException;
import org.apache.kylin.rest.exception.InternalErrorException;
@@ -104,6 +104,10 @@ public class StreamingController extends BasicController {
String project = streamingRequest.getProject();
TableDesc tableDesc = deserializeTableDesc(streamingRequest);
+ if (null == tableDesc) {
+ throw new BadRequestException("Failed to add streaming table.");
+ }
+
StreamingConfig streamingConfig = deserializeSchemalDesc(streamingRequest);
KafkaConfig kafkaConfig = deserializeKafkaSchemalDesc(streamingRequest);
boolean saveStreamingSuccess = false, saveKafkaSuccess = false;
@@ -235,10 +239,12 @@ public class StreamingController extends BasicController {
throw new InternalErrorException("Failed to deal with the request:" + e.getMessage(), e);
}
- String[] dbTable = HadoopUtil.parseHiveTableName(desc.getName());
- desc.setName(dbTable[1]);
- desc.setDatabase(dbTable[0]);
- desc.getIdentity();
+ if (null != desc) {
+ String[] dbTable = HadoopUtil.parseHiveTableName(desc.getName());
+ desc.setName(dbTable[1]);
+ desc.setDatabase(dbTable[0]);
+ desc.getIdentity();
+ }
return desc;
}