In fact, the logic is broken:
if (!file.isAbsolute()) file = new File(basePath + query);
because basePath is null so 'null' is concatenated with the query string (path) resulting in an invalid path.
It should be checked if basePath is null, if so default to "."? Then resolve relative location as:
new File(basePathFile, query);
I'd also say change the log so that the absolute path is also logged in the warning message, otherwise it's really hard to figure out what's going on.