0

I'm getting an unhandled message exception for IOException. As you can see in the pasted code I've handled the IOException. The JDK for both eclipse & the project is Java 8 update 121 so I know catching multiple exceptions is supported. What am I doing wrong?

    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;
    }
  • I guess the call to getResourceAsStream(propertiesFileName) is the source of the Exception? – jfs May 10 '17 at 13:10

1 Answers1

2

You do rethrow ex inside your catch block, which may be an IOException, right?

Harmlezz
  • 7,972
  • 27
  • 35
  • oh... i get it. my method actually propagates up the InvalidBatchMessageProperties exception but not the IOException. Thanks. –  May 10 '17 at 13:11