1

ObjectMapper.readValue method Throws IOException and also its sub classes: JsonParseException and JsonMappingException

extended by java.io.IOException
          extended by com.fasterxml.jackson.core.JsonProcessingException
              extended by com.fasterxml.jackson.core.JsonParseException

For the following code:

return new ObjectMapper().readValue(response, VO.class);

Eclipse suggest and generate a valid surround with try single catch for multiple exceptions with same super class:

} catch (IOException e) {
    Helpers.Debug(e);
}

But for throws it only suggest multiple throws:

throws JsonParseException, JsonMappingException, IOException

Is there a way in Eclipse to suggest/generate a single super class throws as throws IOException?

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
  • your `catch` example is *not* a multi-catch. i am confused about what you are asking for. – Serge Nov 23 '18 at 04:24
  • @Serge multi exceptions in one catch – Ori Marko Nov 23 '18 at 11:24
  • In your example all exceptions which are derived from IOException will be cauthg. A catch in java 8 allows you to catch exceptions listed there, i.e. `catch (ExcA | ExcB | ExcC ex)`. I would say that the latter is the multi-catch. – Serge Nov 23 '18 at 13:59
  • @Serge updated my answer to be more clear – Ori Marko Nov 25 '18 at 06:59

0 Answers0