havocp/config — Issue #1: No exception raised with inexistant classpath configs
Author: masterzen
Created: 2011-12-07 10:46:34+00:00
State: open

Hi,

I'm trying to use this lib in a project and it seems that using:
ConfigFactory.parseResourcesAnySyntax

doesn't throw any exceptions when the resource in question can't be found and setAllowMissing is false and the extension wasn't provided. (If the exception is provided it works).

But reading ConfigImpl.fromBasename if the given config has no extension, and setAllowMissing is false it should throw a ConfigException.IO (line 57).

But this can't happen because the way the resource is checked is confHandle (and other handle) must be null. The problem is that they never can't be null since they're the result of a newResource which in turns does new ParseableResource which could never return null.

And it never ever fails after that, because when parsing the different extensions, setAllowMissing is forced to true to make sure we can try all extensions.

One possible fix would be to do this last operation with setAllowMissing to false, and catch the exception. If nothing had been ever parsed then throw a ConfigException.IO.