-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major
-
Component/s: violations-plugin
-
None
-
Environment:Platform: All, OS: All
Exception when reading findbugs result file ():
java.io.FileNotFoundException: c:\hudson\workspace\job\src\main\com\test(Access is denied)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)
at hudson.plugins.violations.generate.OutputFileModel.open(OutputFileModel.java:152)
at hudson.plugins.violations.generate.OutputFileModel.outputContents(OutputFileModel.java:164)
at hudson.plugins.violations.generate.OutputFileModel.execute(OutputFileModel.java:84)
at hudson.plugins.violations.generate.ExecuteFilePath.execute(ExecuteFilePath.java:45)
at hudson.plugins.violations.generate.GenerateXML.execute(GenerateXML.java:47)
at hudson.plugins.violations.ViolationsCollector.invoke(ViolationsCollector.java:124)
at hudson.plugins.violations.ViolationsCollector.invoke(ViolationsCollector.java:27)
Causes the build to fail because it tries to read a folder.
The following findbugs.xml output generates the exception:
<SourceLine classname="com.test.JiBX_general_bindingFactory" sourcefile="" sourcepath="com/test/"/>
This is because of the sourcepath set by JiBX in the generated classes which matches a directory and not a file.
However Violation plugin should not exception.
Fix is easy, change file.exists() into file.isFile() in AbsoluteFileFinder.java (patch attached).
As Violation will fail when a directory is provided, it also needs to protect against it.