use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException in project spring-boot by spring-projects.
the class JsonObjectDeserializer method deserialize.
@Override
public final T deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
try {
ObjectCodec codec = jp.getCodec();
JsonNode tree = codec.readTree(jp);
return deserializeObject(jp, ctxt, codec, tree);
} catch (Exception ex) {
if (ex instanceof IOException) {
throw (IOException) ex;
}
throw new JsonMappingException(jp, "Object deserialize error", ex);
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException in project dhis2-core by dhis2.
the class JacksonRelationshipService method addRelationshipsXml.
@Override
public ImportSummaries addRelationshipsXml(InputStream inputStream, ImportOptions importOptions) throws IOException {
String input = StreamUtils.copyToString(inputStream, Charset.forName("UTF-8"));
List<Relationship> relationships = new ArrayList<>();
try {
Relationships fromXml = fromXml(input, Relationships.class);
relationships.addAll(fromXml.getRelationships());
} catch (JsonMappingException ex) {
Relationship fromXml = fromXml(input, Relationship.class);
relationships.add(fromXml);
}
return processRelationshipList(relationships, updateImportOptions(importOptions));
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException in project uPortal by Jasig.
the class AnalyticsIncorporationComponent method serializePortletRenderExecutionEvents.
protected String serializePortletRenderExecutionEvents(final Set<PortalEvent> portalEvents) {
// Filter to include just portlet render events
final Map<String, PortletRenderExecutionEvent> renderEvents = new HashMap<>();
for (final PortalEvent portalEvent : portalEvents) {
if (portalEvent instanceof PortletRenderExecutionEvent) {
final PortletRenderExecutionEvent portletRenderEvent = (PortletRenderExecutionEvent) portalEvent;
// Don't write out info for minimized portlets
if (!WindowState.MINIMIZED.equals(portletRenderEvent.getWindowState())) {
final IPortletWindowId portletWindowId = portletRenderEvent.getPortletWindowId();
final String eventKey = portletWindowId != null ? portletWindowId.getStringId() : portletRenderEvent.getFname();
renderEvents.put(eventKey, portletRenderEvent);
}
}
}
try {
return portletEventWriter.writeValueAsString(renderEvents);
} catch (JsonParseException e) {
logger.warn("Failed to convert this request's render events to JSON, no portlet level analytics will be included", e);
} catch (JsonMappingException e) {
logger.warn("Failed to convert this request's render events to JSON, no portlet level analytics will be included", e);
} catch (IOException e) {
logger.warn("Failed to convert this request's render events to JSON, no portlet level analytics will be included", e);
}
return "{}";
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException in project graylog2-server by Graylog2.
the class RetentionStrategyResource method getRetentionStrategyDescription.
private RetentionStrategyDescription getRetentionStrategyDescription(@ApiParam(name = "strategy", value = "The name of the retention strategy", required = true) @PathParam("strategy") @NotEmpty String strategyName) {
final Provider<RetentionStrategy> provider = retentionStrategies.get(strategyName);
if (provider == null) {
throw new NotFoundException("Couldn't find retention strategy for given type " + strategyName);
}
final RetentionStrategy retentionStrategy = provider.get();
final RetentionStrategyConfig defaultConfig = retentionStrategy.defaultConfiguration();
final SchemaFactoryWrapper visitor = new SchemaFactoryWrapper();
try {
objectMapper.acceptJsonFormatVisitor(objectMapper.constructType(retentionStrategy.configurationClass()), visitor);
} catch (JsonMappingException e) {
throw new InternalServerErrorException("Couldn't generate JSON schema for retention strategy " + strategyName, e);
}
return RetentionStrategyDescription.create(strategyName, defaultConfig, visitor.finalSchema());
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonMappingException in project graylog2-server by Graylog2.
the class EncryptedValueDeserializer method parseFromDatabase.
private EncryptedValue parseFromDatabase(JsonParser p, JsonNode node) throws JsonProcessingException {
final JsonNode value = node.path("encrypted_value");
final JsonNode salt = node.path("salt");
if (value.isTextual() && salt.isTextual()) {
return EncryptedValue.builder().value(value.asText()).salt(salt.asText()).isKeepValue(false).isDeleteValue(false).build();
}
throw new JsonMappingException(p, "Couldn't deserialize value: " + node.toString() + " (encrypted_value and salt must be a strings and cannot missing)");
}
Aggregations