多个异常捕获块java 8 eclipse

时间:2017-05-10 13:02:37

标签: eclipse java-8 unhandled-exception

我收到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;
    }

1 个答案:

答案 0 :(得分:2)

你在catch区块中重新抛出ex,这可能是IOException,对吗?