Example usage for com.fasterxml.jackson.databind JsonMappingException getClass

List of usage examples for com.fasterxml.jackson.databind JsonMappingException getClass

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind JsonMappingException getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:ws.doerr.cssinliner.server.InlinerApp.java

private void processHandlebars(SourceInstance instance) throws IOException {
    try (FileWriter writer = new FileWriter(instance.getMerged().toFile())) {
        Template template = handlebars.compile(instance.getInlined().getFileName().toString());
        JsonNode data = Server.getMapper().readTree(instance.getData().toFile());
        Context handlebarsContext = Context.newBuilder(data).resolver(JsonNodeValueResolver.INSTANCE).build();

        template.apply(handlebarsContext, writer);
    } catch (JsonMappingException ex) {
        instance.logError("JSON", ex.getMessage());
        Files.copy(instance.getInlined().toFile(), instance.getMerged().toFile());
    } catch (HandlebarsException ex) {
        instance.logError("Handlebars", ex.getError().reason);
        Files.copy(instance.getInlined().toFile(), instance.getMerged().toFile());
        LOG.log(Level.WARNING, "", ex);
    } catch (FileNotFoundException ex) {
        instance.logError("JSON", "No JSON data file found");
        Files.copy(instance.getInlined().toFile(), instance.getMerged().toFile());
    } catch (Exception ex) {
        instance.logError(ex.getClass().getSimpleName(), ex.getMessage());
        Files.copy(instance.getInlined().toFile(), instance.getMerged().toFile());
        LOG.log(Level.WARNING, "", ex);
    }//w w  w. j ava  2s . co  m
}