Github user MrSandmanRUS commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r203550322
  
    --- Diff: 
phoenix-tracing-webapp/src/main/java/org/apache/phoenix/tracingwebapp/http/TraceServlet.java
 ---
    @@ -98,33 +108,36 @@ protected String getCount(String countby) {
         if(countby == null) {
           countby = DEFAULT_COUNTBY;
         }
    -    // Throws exception if the column not present in the trace table.
    -    MetricInfo.getColumnName(countby.toLowerCase());
         String sqlQuery = "SELECT "+countby+", COUNT(*) AS count FROM " + 
TRACING_TABLE + " GROUP BY "+countby+" HAVING COUNT(*) > 1 ";
         json = getResults(sqlQuery);
         return json;
       }
     
       //search the trace over parent id or trace id
    -  protected String searchTrace(String parentId, String traceId,String 
logic) {
    +  protected String searchTrace(String parentId, String traceId, String 
logic) {
    +
         String json = null;
         String query = null;
         // Check the parent Id, trace id type or long or not.
         try {
    +      if (parentId != null) {
             Long.parseLong(parentId);
    +      }
    +      if (traceId != null) {
             Long.parseLong(traceId);
    +      }
         } catch (NumberFormatException e) {
    -           throw new RuntimeException("The passed parentId/traceId is not 
a number.", e);
    +      throw new RuntimeException("The passed parentId/traceId is not a 
number.", e);
         }
    -    if(!logic.equals(LOGIC_AND) || !logic.equals(LOGIC_OR)) {
    -           throw new RuntimeException("Wrong logical operator passed to 
the query. Only "+ LOGIC_AND+","+LOGIC_OR+" are allowed.") ;
    +    if (logic != null && (!logic.equals(LOGIC_AND) && 
!logic.equals(LOGIC_OR))) {
    --- End diff --
    
    Fixed


---

Reply via email to