Repository: incubator-atlas
Updated Branches:
  refs/heads/0.8-incubating 2d0e78051 -> 74bbeeb57


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

(cherry picked from commit e92593e9462c6b5593109ad13bc761e04ac6d93f)


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

Branch: refs/heads/0.8-incubating
Commit: 74bbeeb5793169f6cb169e7c5a33d3e7cd53fd21
Parents: 2d0e780
Author: Sarath Subramanian <[email protected]>
Authored: Tue Apr 25 13:08:18 2017 -0700
Committer: Sarath Subramanian <[email protected]>
Committed: Tue Apr 25 13:10:34 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/74bbeeb5/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

Reply via email to