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

de.sstoehr.harreader.jackson.ExceptionIgnoringDateDeserializer Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package de.sstoehr.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