atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sar...@apache.org
Subject incubator-atlas git commit: ATLAS-1726 : Creating type name with space causes exceptions while doing DSL search
Date Tue, 25 Apr 2017 20:09:18 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 928bbc5dc -> e92593e94


ATLAS-1726 : Creating type name with space causes exceptions while doing DSL search


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

Branch: refs/heads/master
Commit: e92593e9462c6b5593109ad13bc761e04ac6d93f
Parents: 928bbc5
Author: Sarath Subramanian <ssubramanian@hortonworks.com>
Authored: Tue Apr 25 13:08:18 2017 -0700
Committer: Sarath Subramanian <ssubramanian@hortonworks.com>
Committed: Tue Apr 25 13:08:18 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/atlas/web/rest/DiscoveryREST.java | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/e92593e9/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
index 836626b..76ad88c 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
@@ -82,7 +82,7 @@ public class DiscoveryREST {
             String queryStr = query == null ? "" : query;
 
             if (StringUtils.isNoneEmpty(typeName)) {
-                queryStr = typeName + " " + queryStr;
+                queryStr = escapeTypeName(typeName) + " " + queryStr;
             }
 
             if (StringUtils.isNoneEmpty(classification)) {
@@ -207,4 +207,16 @@ public class DiscoveryREST {
             AtlasPerfTracer.log(perf);
         }
     }
+
+    private String escapeTypeName(String typeName) {
+        String ret;
+
+        if (StringUtils.startsWith(typeName, "`") && StringUtils.endsWith(typeName,
"`")) {
+            ret = typeName;
+        } else {
+            ret = String.format("`%s`", typeName);
+        }
+
+        return ret;
+    }
 }
\ No newline at end of file


Mime
View raw message