justinchuch opened a new pull request, #1731:
URL: https://github.com/apache/groovy/pull/1731

   ## Issue:
   
   PackageHelperImpl#getPackageNames would not be able to find and return
   the package names if the package path or filename of the jar contains
   plus signs due to the behavior of URLDecoder#decode.
   
   URLDecoder#decode would decode the plus sign (i.e. `+`) as empty space, 
causing `java.io.FileNotFoundException`.
   
   
   ## Reproduction
   
   To reproduce the case, include a plus sign in the `groovyVersion` in the 
`gradle.properties`, e.g. `5.0.0+SNAPSHOT`, run the `PackageHelperImplTest`, 
and `testLoadAndGetPackagesEmpty` would fail.
   
   ```
   WARN [org.apache.groovy.groovysh.util.PackageHelperImpl] Error opening jar 
file : '/home/jus/repos/apache/groovy/build/libs/groovy-raw-5.0.0+SNAPSHOT.jar' 
: java.io.FileNotFoundException: 
/home/jus/repos/apache/groovy/build/libs/groovy-raw-5.0.0 SNAPSHOT.jar (No such 
file or directory)
   ...
   ```
   
   ## Proposed fix:
   
   Use `Paths.get(url.toURI()).toFile()` instead of `new 
File(URLDecoder.decode(url.file, 'UTF-8'))`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to