keith-turner commented on code in PR #104:
URL: https://github.com/apache/accumulo-access/pull/104#discussion_r2914968773


##########
modules/core/src/main/java/org/apache/accumulo/access/impl/AccessExpressionImpl.java:
##########
@@ -78,8 +78,16 @@ public static CharSequence quote(CharSequence term) {
 
   public static CharSequence unquote(CharSequence term) {
     final int len = term.length();
-    if (len >= 2 && term.charAt(0) == '"' && term.charAt(len - 1) == '"') {
-      term = len == 2 ? "" : AccessEvaluatorImpl.unescape(term.subSequence(1, 
len - 1));
+    if (len >= 1) {
+      final boolean firstIsQuote = term.charAt(0) == '"';
+      final boolean lastIsQuote = term.charAt(len - 1) == '"';
+      if (firstIsQuote || lastIsQuote) {
+        if (len == 1 || (firstIsQuote ^ lastIsQuote)) {
+          throw new IllegalArgumentException("Unbalanced quotes : " + term);
+        }
+
+        term = len == 2 ? "" : 
AccessEvaluatorImpl.unescape(term.subSequence(1, len - 1));

Review Comment:
   Fixed that error message and added a test for it in 15ddc4c



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to