You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2018/08/22 08:42:01 UTC
[kylin] branch master updated: KYLIN-3507 Avoid NPE when project is
not found
This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git
The following commit(s) were added to refs/heads/master by this push:
new 64dfa7b KYLIN-3507 Avoid NPE when project is not found
64dfa7b is described below
commit 64dfa7b9f7ef95a3edd8548d46a21ea9e71facc7
Author: hujixu <hu...@youzan.com>
AuthorDate: Wed Aug 22 14:59:21 2018 +0800
KYLIN-3507 Avoid NPE when project is not found
---
.../src/main/java/org/apache/kylin/rest/service/QueryService.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java b/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
index f195e74..16358e4 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/service/QueryService.java
@@ -86,6 +86,7 @@ import org.apache.kylin.metadata.model.JoinTableDesc;
import org.apache.kylin.metadata.model.ModelDimensionDesc;
import org.apache.kylin.metadata.model.TableRef;
import org.apache.kylin.metadata.project.ProjectInstance;
+import org.apache.kylin.metadata.project.ProjectManager;
import org.apache.kylin.metadata.querymeta.ColumnMeta;
import org.apache.kylin.metadata.querymeta.ColumnMetaWithType;
import org.apache.kylin.metadata.querymeta.SelectedColumnMeta;
@@ -359,6 +360,11 @@ public class QueryService extends BasicService {
if (StringUtils.isBlank(sqlRequest.getProject())) {
throw new BadRequestException(msg.getEMPTY_PROJECT_NAME());
}
+ // project not found
+ ProjectManager mgr = ProjectManager.getInstance(KylinConfig.getInstanceFromEnv());
+ if (mgr.getProject(sqlRequest.getProject()) == null) {
+ throw new BadRequestException(msg.getPROJECT_NOT_FOUND());
+ }
if (StringUtils.isBlank(sqlRequest.getSql())) {
throw new BadRequestException(msg.getNULL_EMPTY_SQL());
}