Example usage for com.fasterxml.jackson.core JsonGenerationException toString

List of usage examples for com.fasterxml.jackson.core JsonGenerationException toString

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core JsonGenerationException toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:can.yrt.oba.serialization.JacksonSerializer.java

public String serialize(Object obj) {
    StringWriter writer = new StringWriter();
    JsonGenerator jsonGenerator;//from w  w w. j a v a  2 s .  co  m

    try {
        jsonGenerator = new MappingJsonFactory().createJsonGenerator(writer);
        mMapper.writeValue(jsonGenerator, obj);

        return writer.toString();

    } catch (JsonGenerationException e) {
        Log.e(TAG, e.toString());
        return getErrorJson(ObaApi.OBA_INTERNAL_ERROR, e.toString());
    } catch (JsonMappingException e) {
        Log.e(TAG, e.toString());
        return getErrorJson(ObaApi.OBA_INTERNAL_ERROR, e.toString());
    } catch (IOException e) {
        Log.e(TAG, e.toString());
        return getErrorJson(ObaApi.OBA_IO_EXCEPTION, e.toString());
    }
}