java - How to handel JsonMappingException try catch -
this question has reply here:
unable grab jsonmappingexception 6 answersi new jackson, have written code , ide says @ grab block . dont understand . have included jar.
incompatible types required:java.lang.throwable found :org.codehaus.jackson.map.jsonmappingexception
this method
private void jacksontest() { seek { org.codehaus.jackson.map.objectmapper mapper = new org.codehaus.jackson.map.objectmapper(); mapper.writevalue(new file("c:\\user.json"), someobj); } grab (ioexception ex) { logger.getlogger(gr_xx.class.getname()).log(level.severe, null, ex); } grab (jsonmappingexception ex) { // incompatible types // required:java.lang.throwable // found :org.codehaus.jackson.map.jsonmappingexception } grab (exception ex) { logger.getlogger(gr_xx.class.getname()).log(level.severe, null, ex); } grab (throwable ex) { logger.getlogger(gr_xx.class.getname()).log(level.severe, null, ex); } }
as can see in documentation of jsonmappingexception
, subclass of ioexception
. means first catch
handle jsonmappingexception
. if want handle seperately, you'll have grab before ioexception
.
java json jackson try-catch
No comments:
Post a Comment