Search in sources :

Example 1 with GraviteeDescriptorReadException

use of io.gravitee.rest.api.service.exceptions.GraviteeDescriptorReadException in project gravitee-management-rest-api by gravitee-io.

the class GraviteeDescriptorServiceImpl method read.

@Override
public GraviteeDescriptorEntity read(String s) {
    ObjectMapper mapper = new ObjectMapper();
    try {
        GraviteeDescriptorEntity descriptorEntity = mapper.readValue(s, GraviteeDescriptorEntity.class);
        assertVersion(descriptorEntity);
        return descriptorEntity;
    } catch (IOException e) {
        logger.error("An error occurs while trying to read the descriptor", e);
        throw new GraviteeDescriptorReadException("An error occurs while trying to read the descriptor");
    }
}
Also used : GraviteeDescriptorEntity(io.gravitee.rest.api.model.descriptor.GraviteeDescriptorEntity) IOException(java.io.IOException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) GraviteeDescriptorReadException(io.gravitee.rest.api.service.exceptions.GraviteeDescriptorReadException)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 GraviteeDescriptorEntity (io.gravitee.rest.api.model.descriptor.GraviteeDescriptorEntity)1 GraviteeDescriptorReadException (io.gravitee.rest.api.service.exceptions.GraviteeDescriptorReadException)1 IOException (java.io.IOException)1