use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException in project underlx by underlx.
the class API method postPairRequest.
public Pair postPairRequest(PairRequest request) throws APIException {
try {
byte[] content = mapper.writeValueAsBytes(request);
InputStream is = postRequest(endpoint.resolve("pair"), content, false);
return mapper.readValue(is, Pair.class);
} catch (JsonParseException e) {
throw new APIException(e).addInfo("Parse exception");
} catch (JsonMappingException e) {
throw new APIException(e).addInfo("Mapping exception");
} catch (IOException e) {
throw new APIException(e).addInfo("IOException");
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException in project underlx by underlx.
the class API method postFeedback.
public Feedback postFeedback(Feedback request) throws APIException {
try {
byte[] content = mapper.writeValueAsBytes(request);
InputStream is = postRequest(endpoint.resolve("feedback"), content, true);
return mapper.readValue(is, Feedback.class);
} catch (JsonParseException e) {
throw new APIException(e).addInfo("Parse exception");
} catch (JsonMappingException e) {
throw new APIException(e).addInfo("Mapping exception");
} catch (IOException e) {
throw new APIException(e).addInfo("IOException");
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException in project underlx by underlx.
the class API method putTrip.
public Trip putTrip(TripRequest request) throws APIException {
try {
byte[] content = mapper.writeValueAsBytes(request);
InputStream is = putRequest(endpoint.resolve("trips"), content, true);
return mapper.readValue(is, Trip.class);
} catch (JsonParseException e) {
throw new APIException(e).addInfo("Parse exception");
} catch (JsonMappingException e) {
throw new APIException(e).addInfo("Mapping exception");
} catch (IOException e) {
throw new APIException(e).addInfo("IOException");
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException in project underlx by underlx.
the class API method postTrip.
public Trip postTrip(TripRequest request) throws APIException {
try {
byte[] content = mapper.writeValueAsBytes(request);
InputStream is = postRequest(endpoint.resolve("trips"), content, true);
return mapper.readValue(is, Trip.class);
} catch (JsonParseException e) {
throw new APIException(e).addInfo("Parse exception");
} catch (JsonMappingException e) {
throw new APIException(e).addInfo("Mapping exception");
} catch (IOException e) {
throw new APIException(e).addInfo("IOException");
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException in project candlepin by candlepin.
the class ListenerWrapperTest method whenMapperReadThrowsExceptionThenOnMessageShouldFail.
@Test(expected = RuntimeException.class)
public void whenMapperReadThrowsExceptionThenOnMessageShouldFail() throws Exception {
doReturn("test123").when(activeMQBuffer).readString();
doThrow(new JsonMappingException("Induced exception")).when(mapper).readValue(anyString(), eq(Event.class));
this.listenerWrapper.onMessage(mockClientMessage);
}
Aggregations