Hello Chandan,

seems a bug in the JPA processor or more in the JPAs-Visitor. 

The expression tree serialized with a test visitor shows that the parenthesis 
are correctly evaluated.
I added a test to file "TestParser.java"

  @Test
  public void testAndOr() {
    //A
    GetPTF("(SoId eq 2 or SoId eq 3 or SoId eq 4) and Delivered eq true")
      .aSerialized("{{{{SoId eq 2} or {SoId eq 3}} or {SoId eq 4}} and 
{Delivered eq true}}");
    
    //B
    GetPTF("SoId eq 2 or SoId eq 3 or SoId eq 4 and Delivered eq true")
    .aSerialized("{{{SoId eq 2} or {SoId eq 3}} or {{SoId eq 4} and {Delivered 
eq true}}}");
  }

It shows that in A the "or's" in the pathentesis are gouped together.
Where as in B the "and" is first grouped because and has a higher priority.

Regards,
Sven



-----Original Message-----
From: Giacomo Pati [mailto:[email protected]] 
Sent: Freitag, 31. Oktober 2014 08:41
To: [email protected]
Subject: Serious bug in FilterParser

Hi all

We recently run into a serious issue regarding filters and I want someone
of you to double check. When you run the following query against a
deployed olingo-odata2-jpa-processor-ref-web
like

http://localhost:8080/SalesOrderProcessing.svc/SalesOrderItems?$filter=(SoId
eq 2 or SoId eq 3 or SoId eq 4) and Delivered eq true

one would expect to see only Entities with a property Delivered == true but
this is not the case. I've also run a quick junit test against
FilterParserImpl with such a query using an ExpressionVisitor and figured
that it seems that the parenthesis are not respected which would reduce the
query to "SoId eq 2 or SoId eq 3 or SoId eq 4 and Delivered eq true" and it
seems that is actually what happens.

Anyone else?

Ciao
-- 
Giacomo

Reply via email to