--- old/src/share/classes/com/sun/java/util/jar/pack/PropMap.java 2011-02-23 19:49:38.032375447 -0800 +++ new/src/share/classes/com/sun/java/util/jar/pack/PropMap.java 2011-02-23 19:49:37.719727257 -0800 @@ -122,26 +122,26 @@ // Define certain attribute layouts by default. // Do this after the previous props are put in place, // to allow override if necessary. - InputStream propStr = null; - try { - String propFile = "intrinsic.properties"; - propStr = PackerImpl.class.getResourceAsStream(propFile); - props.load(new BufferedInputStream(propStr)); - for (Map.Entry e : props.entrySet()) { - String key = (String) e.getKey(); - String val = (String) e.getValue(); - if (key.startsWith("attribute.")) { - e.setValue(Attribute.normalizeLayoutString(val)); - } - } + String propFile = "intrinsic.properties"; + + // TODO TWR: narrowed the scope of IOException handling + boolean propsLoaded = false; + try (InputStream propStr = PackerImpl.class.getResourceAsStream(propFile)) { + props.load(propStr); + propsLoaded = true; } catch (IOException ee) { - throw new RuntimeException(ee); - } finally { - try { - if (propStr != null) { - propStr.close(); - } - } catch (IOException ignore) {} + // ignore exception if it came from the close() + if (!propsLoaded) { + throw new RuntimeException(ee); + } + } + + for (Map.Entry e : props.entrySet()) { + String key = (String) e.getKey(); + String val = (String) e.getValue(); + if (key.startsWith("attribute.")) { + e.setValue(Attribute.normalizeLayoutString(val)); + } } defaultProps = (new HashMap<>(props)); // shrink to fit