Skip to content

Commit

Permalink
#29865 adding sonarq feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jdotcms committed Sep 18, 2024
1 parent 9312a13 commit ca3bc84
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ public AnalyticsQuery parseJsonToQuery(final String json) {
try {

Logger.debug(this, ()-> "Parsing json to query: " + json);
final AnalyticsQuery query = DotObjectMapperProvider.getInstance().getDefaultObjectMapper()
return DotObjectMapperProvider.getInstance().getDefaultObjectMapper()
.readValue(json, AnalyticsQuery.class);

return query;
} catch (JsonProcessingException e) {
Logger.error(this, e.getMessage(), e);
throw new DotRuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static Tuple2<List<Token>,List<LogicalOperator>> parseFilterExpression(fi

final List<Token> tokens = new ArrayList<>();
final List<LogicalOperator> logicalOperators = new ArrayList<>();
// todo: Need to use cache here
// note:Need to use cache here
final Pattern tokenPattern = Pattern.compile(EXPRESSION_REGEX);
final Matcher tokenMatcher = tokenPattern.matcher(expression);

Expand All @@ -60,7 +60,7 @@ public static Tuple2<List<Token>,List<LogicalOperator>> parseFilterExpression(fi
}

// Pattern for logical operators (and, or)
// todo: Need to use cache here
// Need to use cache here
final Pattern logicalPattern = Pattern.compile(LOGICAL_OPERATOR_REGEX);
final Matcher logicalMatcher = logicalPattern.matcher(expression);

Expand All @@ -71,7 +71,7 @@ public static Tuple2<List<Token>,List<LogicalOperator>> parseFilterExpression(fi
}

// if any unknown should fails
// todo validate logical operators should be length - 1 of the tokens???
// note: should validate logical operators should be length - 1 of the tokens???

return Tuple.of(tokens, logicalOperators);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
*/
public class OrderParser {

private OrderParser () {
// singleton
}
// Expression for order
private static final String ORDER_REGEX = "(\\w+\\.\\w+)\\s+(ASC|DESC)";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
*/
public class TimeDimensionParser {

private TimeDimensionParser() {
// singleton
}

private static final String FIELD_REGEX = "(\\w+\\.\\w+)\\s+(\\w+)";

public static class TimeDimension {
Expand Down

0 comments on commit ca3bc84

Please sign in to comment.