Search in sources :

Example 16 with JsonGenerationException

use of com.fasterxml.jackson.core.JsonGenerationException in project jena by apache.

the class JsonLDWriter method serialize.

private void serialize(Writer writer, DatasetGraph dataset, PrefixMap prefixMap, String baseURI, Context jenaContext) {
    try {
        Object obj = toJsonLDJavaAPI(getVariant(), dataset, prefixMap, baseURI, jenaContext);
        if (getVariant().isPretty()) {
            JsonUtils.writePrettyPrint(writer, obj);
        } else {
            JsonUtils.write(writer, obj);
        }
        writer.write("\n");
    } catch (JsonLdError | JsonMappingException | JsonGenerationException e) {
        throw new RiotException(e);
    } catch (IOException e) {
        IO.exception(e);
    }
}
Also used : RiotException(org.apache.jena.riot.RiotException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) IOException(java.io.IOException) JsonGenerationException(com.fasterxml.jackson.core.JsonGenerationException) JsonLdError(com.github.jsonldjava.core.JsonLdError)

Example 17 with JsonGenerationException

use of com.fasterxml.jackson.core.JsonGenerationException in project dropbox-sdk-java by dropbox.

the class StoneSerializer method serialize.

public void serialize(T value, OutputStream out, boolean pretty) throws IOException {
    JsonGenerator g = Util.JSON.createGenerator(out);
    if (pretty) {
        g.useDefaultPrettyPrinter();
    }
    try {
        serialize(value, g);
    } catch (JsonGenerationException ex) {
        throw new IllegalStateException("Impossible JSON generation exception", ex);
    }
    g.flush();
}
Also used : JsonGenerator(com.fasterxml.jackson.core.JsonGenerator) JsonGenerationException(com.fasterxml.jackson.core.JsonGenerationException)

Aggregations

JsonGenerationException (com.fasterxml.jackson.core.JsonGenerationException)17 IOException (java.io.IOException)9 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)8 Test (org.junit.Test)3 RequestFailedException (com.cribbstechnologies.clients.mandrill.exception.RequestFailedException)2 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 BaseMandrillRequest (com.cribbstechnologies.clients.mandrill.model.BaseMandrillRequest)1 MandrillError (com.cribbstechnologies.clients.mandrill.model.MandrillError)1 BaseMandrillStringResponse (com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillStringResponse)1 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 InvalidFormatException (com.fasterxml.jackson.databind.exc.InvalidFormatException)1 PropertyBindingException (com.fasterxml.jackson.databind.exc.PropertyBindingException)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 JaxbAnnotationModule (com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule)1 JsonLdError (com.github.jsonldjava.core.JsonLdError)1 ErrorMessage (io.dropwizard.jersey.errors.ErrorMessage)1 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1 StringWriter (java.io.StringWriter)1