salesforce-marketingcloud / FuelSDK-Java

Salesforce Marketing Cloud Java SDK
BSD 3-Clause "New" or "Revised" License
73 stars 122 forks source link

ETFilter and ETExpression #44

Open hanpolitico opened 8 years ago

hanpolitico commented 8 years ago

I'm seeing this error when upgrading from 1.0.1 to 1.0.3

1.0.1

ETFilter nameFilter = new ETFilter(); nameFilter.setProperty("ListName"); nameFilter.addValue("Breaking News"); nameFilter.setOperator(ETFilter.Operator.EQUALS); // ListName = Breaking News

ETFilter andFilter = new ETFilter(); andFilter.getFilters().add(nameFilter); andFilter.setOperator(ETFilter.Operator.AND);

ETFilter folderFilter = new ETFilter(); folderFilter.setProperty("Category"); folderFilter.addValue("123456"); folderFilter.setOperator(ETFilter.Operator.EQUALS); // Category = 123456

andFilter.getFilters().add(folderFilter); // ListName = Breaking News AND Category = 123456

ETResponse<ETList> response = new ETResponse<>(); response = client.retrieve(ETList.class, andFilter);

correctly retrieves the List named Breaking News in the Folder with the ID 123456

1.0.3

// same code as above throws this error Index: 0, Size: 0 (java.lang.IndexOutOfBoundsException) java.util.ArrayList.rangeCheck(ArrayList.java:653) java.util.ArrayList.get(ArrayList.java:429) com.exacttarget.fuelsdk.ETExpression.toString(ETExpression.java:183) com.exacttarget.fuelsdk.ETObject.toString(ETObject.java:112)

I updated our code to use ETExpression, but it seems like client.retrieve(ETList.class, andFilter) only evaluates the main expression, and ignores any subexpressions.