Skip to content

Commit

Permalink
Fix data anonymizer failures by updating legacy parser.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury Fridlyand <yuryf@bitquilltech.com>
  • Loading branch information
Yury-Fridlyand committed Jun 28, 2022
1 parent 9e2a9ff commit d9d25ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,13 @@ public SQLExpr primary() {
lexer.nextToken();
String prefix = "";
while (lexer.token() != Token.RBRACKET) {
/*
if (lexer.token() != Token.IDENTIFIER && lexer.token() != Token.INDEX
&& lexer.token() != Token.LITERAL_CHARS) {
&& lexer.token() != Token.LITERAL_CHARS && lexer.token() != Token.LITERAL_ALIAS) {
throw new ParserException("All items between Brackets should be identifiers , got:"
+ lexer.token());
}
*/
identifier.append(prefix);
identifier.append(lexer.stringVal());
prefix = " ";
Expand Down Expand Up @@ -496,7 +498,7 @@ public final SQLExpr primaryRest(SQLExpr expr) {
expr = methodInvokeExpr;

return primaryRest(expr);
} else if ("MATCH".equalsIgnoreCase(ident)) {
}/* else if ("MATCH".equalsIgnoreCase(ident)) {
lexer.nextToken();
MySqlMatchAgainstExpr matchAgainstExpr = new MySqlMatchAgainstExpr();
Expand Down Expand Up @@ -545,7 +547,7 @@ public final SQLExpr primaryRest(SQLExpr expr) {
expr = matchAgainstExpr;
return primaryRest(expr);
} else if ("CONVERT".equalsIgnoreCase(ident)) {
}*/ else if ("CONVERT".equalsIgnoreCase(ident)) {
lexer.nextToken();
SQLMethodInvokeExpr methodInvokeExpr = new SQLMethodInvokeExpr(ident);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static String anonymizeData(String query) {
.replaceAll("[\\n][\\t]+", " ");
} catch (Exception e) {
LOG.warn("Caught an exception when anonymizing sensitive data");
resultQuery = query;
resultQuery = "";
}
return resultQuery;
}
Expand Down

0 comments on commit d9d25ad

Please sign in to comment.