无法捕获JsonMappingException [英] Unable to catch JsonMappingException

查看:734
本文介绍了无法捕获JsonMappingException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的IDE使用 mapper.readValue 未处理的异常com.fasterxml.jackson.databind.JsonMappingException c> line

My IDE is giving me the error Unhandled Exception com.fasterxml.jackson.databind.JsonMappingException with the mapper.readValue line

ObjectMapper mapper = new ObjectMapper();
try {
    if (response.isEmpty()) {
        //Http 204 (No Content) returned from MCC
        //We should handle this differently
        user = new User();
    } else {
        user = mapper.readValue(response, User.class);
    }
} catch (IOException ioe) {
    logger.log(Level.SEVERE, ioe.getLocalizedMessage());
}
return user;

我试过捕捉 JsonMappingException 但是它没有让错误消失。有什么想法?

I've tried catching the JsonMappingException but it didn't make the error go away. Any thoughts?

推荐答案

JsonMappingException extends IOException ,所以你的IDE有一些更深层次的麻烦 - 也许库输入搞砸了?

JsonMappingException extends IOException, so your IDE is having some deeper trouble of its own -- perhaps library imports are messed up?

这篇关于无法捕获JsonMappingException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆