-
Notifications
You must be signed in to change notification settings - Fork 234
Closed
Description
Passing in a null URL into this constructor does not fail:
STGroupFile(URL url, String encoding, delimiterStartChar, char delimiterStopChar)
This constructor: STGroupFile(String fileName, char delimiterStartChar, char delimiterStopChar) will throw a MalformedURLException if the file cannot be found.
Inconsistent behaviour aside, this constructor allows us to instantiate the STGroupFile with a null URL, meaning that we can call load(), mark the alreadyLoaded flag as true, load will fail and the STGroupFile Object is in a state from which we can never recover or easily find out what went wrong.
Required Fix:
- Fix the constructors so they throw the same exceptions (in particular MalformedURLException, preferably IllegalArgumentException for nulls).
Nice-to-have:
- Fix load so that if loading fails the alreadyLoaded flag is reset, and throw an exception from this method that isn't just a NullPointerException.