review request for 7021582, use try-with-resources in jar/zip implementation and tests

Stuart Marks stuart.marks at
Thu Feb 24 23:20:50 UTC 2011

On 2/24/11 2:20 AM, Alan Bateman wrote:
> All looks okay to me except for
> src/share/classes/com/sun/java/util/jar/pack/
> At L129 it uses getResourceAsStream and that will return null if the properties
> file doesn't exist causing props.load to throw NPE. I realize the original code
> will NPE too but maybe this should be fixed while you are in the area.

Now that I'm looking at this more closely, what should happen if the properties 
file doesn't exist? This is in a static initializer and it's attempting to load 
"" which should always be present -- if it's not present, 
the system was constructed improperly.

So, if isn't found, what should happen? Ignore this (seems 
like a bad idea); issue warning message (how?); throw something like 
FileNotFoundException? Well, static initializers can't throw checked 
exceptions, so maybe throw a RuntimeException with a suitable message?

Advice appreciated.


More information about the core-libs-dev mailing list