jsonschema2pojo
jsonschema2pojo copied to clipboard
bugfix: 'java.lang.IllegalArgumentException: protocol = http host = n…
java.lang.IllegalArgumentException: protocol = http host = null' will throw when source path is a http/https url
It looks like this fix will silently ignore these paths. Is that right? That doesn't seem like a good solution.
I took a quick look at this. Here are my thoughts:
What is needed is a guard around the call to FilenameUtils.normalize, so that only elements of sourcePaths[i] that do not have a protocol will be normalized. Something like:
if( URLUtil.parseProtocol(sourcePaths[i]) == URLProtocol. NO_PROTOCOL ) {
sourcePaths[i] = FilenameUtils.normalize(sourcePaths[i]);
}
This will only normalize local file system paths, but it seems like the intended behavior. sourcePaths is treated as an array of URLs/file system paths in the next block of code. It may be even better to normalize it right in the URLUtil.parseUrl method.