[ 
https://issues.apache.org/jira/browse/ACCUMULO-1730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13774641#comment-13774641
 ] 

Eric Newton commented on ACCUMULO-1730:
---------------------------------------

This code
{noformat}
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.accumulo.core.security.ColumnVisibility.Node;


public class Test {
  
  static void printTree(int indent, String v, Node node) {
    for (int i = 0; i < indent; i++)
      System.out.print(' ');
    System.out.println(node.getType() + " " + v.substring(node.getTermStart(), 
node.getTermEnd()) + " " + node.getTermStart() + " " + node.getTermEnd());
    for (Node child : node.getChildren()) {
      printTree(indent + 1, v, child);
    }
  }
  
  public static void main(String[] args) {
    String s = "(W)|(U|V)";
    ColumnVisibility v = new ColumnVisibility(s);
    System.out.println(s);
    printTree(0, s, v.getParseTree());
  }
  
}
{noformat}

prints this:

{noformat}
(W)|(U|V)
OR  0 0
 TERM W 1 2
 OR (W)|(U|V 0 8
  TERM U 5 6
  TERM V 7 8
{noformat}

                
> ColumnVisibility parse tree nodes do not have correct location offsets for 
> AND and OR nodes
> -------------------------------------------------------------------------------------------
>
>                 Key: ACCUMULO-1730
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-1730
>             Project: Accumulo
>          Issue Type: Bug
>          Components: client
>    Affects Versions: 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.5.0
>            Reporter: John Stoneham
>            Assignee: Eric Newton
>            Priority: Trivial
>             Fix For: 1.4.5, 1.5.1, 1.6.0
>
>
> Trying to do some transformations on visibility strings and running into 
> issues working with the parse tree:
> Clojure 1.5.1
> user=> (import [org.apache.accumulo.core.security ColumnVisibility])
> org.apache.accumulo.core.security.ColumnVisibility
> user=> (def vis (ColumnVisibility. "(W)|(U|V)"))
> #'user/vis
> user=> (.getTermStart (first (.getChildren (.getParseTree vis))))
> 1
> user=> (.getTermEnd (first (.getChildren (.getParseTree vis))))
> 2
> user=> (.getTermStart (second (.getChildren (.getParseTree vis))))
> 0
> user=> (.getTermEnd (second (.getChildren (.getParseTree vis))))
> 8
> Shouldn't those last two be 5 and 8?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to