Join GitHub today
[core] Incremental Analysis doesn't close file correctly on Windows upon a cache hit #618
Hi I'm a developer of Gradle and recently I found there might be some issue in pmd plugin. If I turn on the incremental analysis, some files wouldn't be closed correctly on Windows .
To reproduce it, you should have a windows machine. Mine is Windows 7. Here're the steps:
Looks like some files are not closed correctly, so the cleanup failed. As a comparison, you can run
I'm not familiar with pmd, so I'm here for help, is there any possibility of not closing file correctly?
@jsotuyod Could you help me?
@blindpirate nice catch!
Definitely our bug, here is the culprit https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/SourceCodeProcessor.java#L92-L105
I'll patch it soon, so you may try with the 6.0.0-SNAPSHOT
- File encoding is converted to Charset only once. Errors in it's setup wil fail the run immeditable instead of producing one error per file. - We make sure to close the source stream from the same place we create it, by using try-with-resources - When wrapping the stream to a reader, we use try-with-resources again, just in case - The bechmark code now takes into account charset setup, and more closely resembles the normal execution path - This fixes pmd#618