de.sstoehr.harreader.jackson.ExceptionIgnoringDateDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of har-reader Show documentation
Show all versions of har-reader Show documentation
A library to access HTTP archive format with Java
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);
}
}