In fact, the logic is broken:
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:
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.