我收到IOException的未处理邮件异常。正如您在粘贴的代码中看到的那样,我已经处理了IOException。 eclipse& amp;的JDK该项目是Java 8更新121所以我知道支持捕获多个异常。我做错了什么?
try (InputStream inputStream = BatchMessageProperties.class.getClassLoader().
getResourceAsStream(propertiesFileName)) {
load(inputStream);
//need to make sure all properties are present & not null.
validate(this);
} catch (IOException | InvalidBatchMessagePropertiesFileException ex) {
logger.error(ex.getLocalizedMessage());
ex.printStackTrace();
throw ex;
}
答案 0 :(得分:2)
你在catch区块中重新抛出ex
,这可能是IOException
,对吗?