ATLAS-4461: DSL Search : DSL Search with only typename throws NPE
Signed-off-by: Sidharth Mishra <sidmishra@apache.org>
This commit is contained in:
parent
f08003d136
commit
a5ffaae5cb
|
|
@ -110,16 +110,16 @@ public class DiscoveryREST {
|
|||
Servlets.validateQueryParamLength("typeName", typeName);
|
||||
Servlets.validateQueryParamLength("classification", classification);
|
||||
|
||||
if (StringUtils.isNotEmpty(query) && query.length() > maxDslQueryLength) {
|
||||
throw new AtlasBaseException(AtlasErrorCode.INVALID_QUERY_LENGTH, Constants.MAX_DSL_QUERY_STR_LENGTH);
|
||||
if (StringUtils.isNotEmpty(query)) {
|
||||
if (query.length() > maxDslQueryLength) {
|
||||
throw new AtlasBaseException(AtlasErrorCode.INVALID_QUERY_LENGTH, Constants.MAX_DSL_QUERY_STR_LENGTH);
|
||||
}
|
||||
query = Servlets.decodeQueryString(query);
|
||||
}
|
||||
|
||||
AtlasPerfTracer perf = null;
|
||||
|
||||
try {
|
||||
|
||||
query = Servlets.decodeQueryString(query);
|
||||
|
||||
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
|
||||
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "DiscoveryREST.searchUsingDSL(" + query + "," + typeName
|
||||
+ "," + classification + "," + limit + "," + offset + ")");
|
||||
|
|
|
|||
|
|
@ -214,8 +214,12 @@ public final class Servlets {
|
|||
}
|
||||
}
|
||||
|
||||
public static String decodeQueryString(String query) {
|
||||
return UriUtils.decode(query,"UTF-8");
|
||||
|
||||
public static String decodeQueryString(String query) throws AtlasBaseException {
|
||||
try {
|
||||
return UriUtils.decode(query,"UTF-8");
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error occurred while decoding query:" + query, e.getMessage());
|
||||
throw new AtlasBaseException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue