private static void validateJsonNode(JsonNode node) { if (!node.isObject()) { throw new RuntimeJsonMappingException("Expected object to load ConfigSource but got " + node); } }
@Override public Object decode(Response response, Type type) throws IOException { if (response.status() == 404) return Util.emptyValueOf(type); if (response.body() == null) return null; Reader reader = response.body().asReader(); if (!reader.markSupported()) { reader = new BufferedReader(reader, 1); } try { // Read the first byte to see if we have any data reader.mark(1); if (reader.read() == -1) { return null; // Eagerly returning null avoids "No content to map due to end-of-input" } reader.reset(); return mapper.readValue(reader, mapper.constructType(type)); } catch (RuntimeJsonMappingException e) { if (e.getCause() != null && e.getCause() instanceof IOException) { throw IOException.class.cast(e.getCause()); } throw e; } } }
@Override public Object decode(Response response, Type type) throws IOException, FeignException { if (response.body() == null) { return null; } Reader reader = response.body().asReader(); if (!reader.markSupported()) { reader = new BufferedReader(reader, 1); } try { // Read the first byte to see if we have any data reader.mark(1); if (reader.read() == -1) { return null; // Eagerly returning null avoids "No content to map due to end-of-input" } reader.reset(); return mapper.readValue(reader, mapper.constructType(type)); } catch (RuntimeJsonMappingException e) { Throwable cause = e.getCause(); if (cause != null && cause instanceof IOException) { throw IOException.class.cast(cause); } throw e; } } }
protected <R> R _handleMappingException(JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); }
@Override public T next() { try { return nextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
@Override public boolean isEmpty(SerializerProvider provider, T value) { // First, absent value (note: null check is just sanity check here) if (!_isValuePresent(value)) { return true; } Object contents = _getReferenced(value); if (contents == null) { // possible for explicitly contained `null` return _suppressNulls; } if (_suppressableValue == null) { return false; } JsonSerializer<Object> ser = _valueSerializer; if (ser == null) { try { ser = _findCachedSerializer(provider, contents.getClass()); } catch (JsonMappingException e) { // nasty but necessary throw new RuntimeJsonMappingException(e); } } if (_suppressableValue == MARKER_FOR_EMPTY) { return ser.isEmpty(provider, contents); } return _suppressableValue.equals(contents); }
return jp.getText().toUpperCase(); } catch (IOException e) { throw new RuntimeJsonMappingException(e.getMessage()); return jp.getText().toUpperCase(); } catch (IOException e) { throw new RuntimeJsonMappingException(e.getMessage());
private ObjectNode normalizeValidateObjectNode(Object object) throws IOException { JsonNode node = treeObjectMapper.readTree(treeObjectMapper.writeValueAsString(object)); if (!node.isObject()) { throw new RuntimeJsonMappingException("Expected object to load Config but got "+node); } return (ObjectNode) node; } }
private ObjectNode normalizeValidateObjectNode(Object object) throws IOException { JsonNode node = treeObjectMapper.readTree(treeObjectMapper.writeValueAsString(object)); if (!node.isObject()) { throw new RuntimeJsonMappingException("Expected object to load Config but got "+node); } return (ObjectNode) node; } }
protected <R> R _handleMappingException(JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); }
protected <R> R _handleMappingException(JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); }
protected <R> R _handleMappingException(JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); }
protected <R> R _handleMappingException(JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); }
public T next() { try { return nextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
@Override public T next() { try { return nextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
@Override public T next() { try { return nextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
public boolean hasNext() { try { return hasNextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
@Override public T next() { try { return nextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }
@Override public T next() { try { return nextValue(); } catch (JsonMappingException e) { throw new RuntimeJsonMappingException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } }