All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.browserup.harreader.jackson.ExceptionIgnoringDateDeserializer Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
package com.browserup.harreader.jackson;

import java.io.IOException;
import java.util.Date;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.deser.std.DateDeserializers;

public class ExceptionIgnoringDateDeserializer extends JsonDeserializer {

    @Override
    public Date deserialize(JsonParser jp, DeserializationContext ctxt) throws java.io.IOException {
        try {
            DateDeserializers.DateDeserializer dateDeserializer = new DateDeserializers.DateDeserializer();
            return dateDeserializer.deserialize(jp, ctxt);
        } catch (IOException e) {
            //ignore
        }
        return new Date(0L);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy