Browse Source

Reverted exception in ArrayIndexFilter and fixed tests.

pull/30/merge
Kalle Stenflo 11 years ago
parent
commit
3e46d80b62
  1. 3
      json-path/src/main/java/com/jayway/jsonpath/internal/filter/ArrayIndexFilter.java
  2. 3
      json-path/src/test/java/com/jayway/jsonpath/IssuesTest.java

3
json-path/src/main/java/com/jayway/jsonpath/internal/filter/ArrayIndexFilter.java

@ -97,7 +97,8 @@ public class ArrayIndexFilter extends PathTokenFilter {
String[] indexArr = COMMA.split(trimmedCondition);
if(obj == null || jsonProvider.length(obj) == 0){
throw new PathNotFoundException("Failed to access array index: '" + condition + "' since the array is null or empty");
//throw new PathNotFoundException("Failed to access array index: '" + condition + "' since the array is null or empty");
return result;
}
if (indexArr.length == 1) {

3
json-path/src/test/java/com/jayway/jsonpath/IssuesTest.java

@ -23,7 +23,8 @@ import static org.junit.Assert.assertThat;
*/
public class IssuesTest {
@Test
//@Test(expected = PathNotFoundException.class)
@Test()
public void issue_11() throws Exception {
String json = "{ \"foo\" : [] }";
List<String> result = JsonPath.read(json, "$.foo[?(@.rel= 'item')][0].uri");

Loading…
Cancel
Save