Example usage for com.fasterxml.jackson.databind JsonMappingException from

List of usage examples for com.fasterxml.jackson.databind JsonMappingException from

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind JsonMappingException from.

Prototype

public static JsonMappingException from(JsonParser paramJsonParser, String paramString,
            Throwable paramThrowable) 

Source Link

Usage

From source file:org.hyperledger.jackson.AddressDeserializer.java

@Override
public UIAddress deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    JsonToken t = jp.getCurrentToken();//from  ww  w.j  a  v a 2 s .c  o m
    if (t == JsonToken.VALUE_STRING) {
        try {
            String satoshiStyle = jp.getText().trim();
            if (satoshiStyle.length() == 0) {
                return null;
            }

            return UIAddress.fromSatoshiStyle(satoshiStyle);
        } catch (HyperLedgerException e) {
            throw JsonMappingException.from(jp, "Error deserializing address", e);
        }
    }

    throw ctxt.mappingException(handledType());
}

From source file:org.hyperledger.jackson.MasterPublicKeyDeserializer.java

@Override
public MasterPublicKey deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    JsonToken t = jp.getCurrentToken();//w  ww .  j a  v a 2 s  .com
    if (t == JsonToken.VALUE_STRING) {
        try {
            String keyString = jp.getText().trim();
            if (keyString.length() == 0) {
                return null;
            }

            return MasterPublicKey.parse(keyString);
        } catch (HyperLedgerException e) {
            throw JsonMappingException.from(jp, "Error deserializing extended key", e);
        }
    }

    throw ctxt.mappingException(handledType());
}

From source file:org.hyperledger.jackson.MasterPrivateKeyDeserializer.java

@Override
public MasterPrivateKey deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
    JsonToken t = jp.getCurrentToken();/*  ww w.  ja v a2s  .  c o  m*/
    if (t == JsonToken.VALUE_STRING) {
        try {
            String keyString = jp.getText().trim();
            if (keyString.length() == 0) {
                return null;
            }

            return MasterPrivateKey.parse(keyString);
        } catch (HyperLedgerException e) {
            throw JsonMappingException.from(jp, "Error deserializing extended key", e);
        }
    }

    throw ctxt.mappingException(handledType());
}

From source file:com.bitsofproof.dropwizard.supernode.jackson.AddressDeserializer.java

@Override
public Address deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException, JsonProcessingException {
    JsonToken t = jp.getCurrentToken();/*from  w  w  w  .  j  av a2  s  . c o m*/
    if (t == JsonToken.VALUE_STRING) {
        try {
            String satoshiStyle = jp.getText().trim();
            if (satoshiStyle.length() == 0) {
                return null;
            }

            return Address.fromSatoshiStyle(satoshiStyle);
        } catch (ValidationException e) {
            throw JsonMappingException.from(jp, "Error deserializing bitcoin address", e);
        }
    }

    throw ctxt.mappingException(getValueClass());
}