jsonschema2pojo icon indicating copy to clipboard operation
jsonschema2pojo copied to clipboard

bugfix: 'java.lang.IllegalArgumentException: protocol = http host = n…

Open colinstonema opened this issue 6 years ago • 2 comments
trafficstars

java.lang.IllegalArgumentException: protocol = http host = null' will throw when source path is a http/https url

colinstonema avatar May 13 '19 01:05 colinstonema

It looks like this fix will silently ignore these paths. Is that right? That doesn't seem like a good solution.

joelittlejohn avatar May 13 '19 07:05 joelittlejohn

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.

ctrimble avatar May 13 '19 20:05 ctrimble