Browse Source

Store problematic JSON in exception

Rather than logging the JSON that is problematic store it as part of the exception.  Remove the logger since it is no longer being used.
pull/126/head
Archimedes Trajano 9 years ago
parent
commit
cba33fba05
  1. 7
      json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonProvider.java

7
json-path/src/main/java/com/jayway/jsonpath/spi/json/JacksonJsonProvider.java

@ -18,8 +18,6 @@ import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.jayway.jsonpath.InvalidJsonException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
@ -31,8 +29,6 @@ import java.util.List;
public class JacksonJsonProvider extends AbstractJsonProvider {
private static final Logger logger = LoggerFactory.getLogger(JacksonJsonProvider.class);
private static final ObjectMapper defaultObjectMapper = new ObjectMapper();
private static final ObjectReader defaultObjectReader = defaultObjectMapper.reader().withType(Object.class);
@ -73,8 +69,7 @@ public class JacksonJsonProvider extends AbstractJsonProvider {
try {
return objectReader.readValue(json);
} catch (IOException e) {
logger.debug("Invalid JSON: \n" + json);
throw new InvalidJsonException(e);
throw new InvalidJsonException(e, json);
}
}

Loading…
Cancel
Save