Affects PMD Version:
6.0.1
Rule:
Description:
When supplying a file list and requesting display of short names, the parameter inputFileName
to the function FileDataSource.glomName
is unset, thus causing NullPointerException
at line 40:
if (shortNames && inputFileName.indexOf(',') == -1) {
The inputFileName
parameter is passed with configuration.getInputPaths()
(AbstractPMDProcessor.java:57
). The inputPaths
field of configuration
is set to null
because there is no --directory
parameter passed on the command line. But passing this parameter will cause all source files under the directory to be included rather than just the files specified in file list.
Code Sample demonstrating the issue:
Error message:
java.lang.NullPointerException
at net.sourceforge.pmd.util.datasource.FileDataSource.glomName(FileDataSource.java:40)
at net.sourceforge.pmd.util.datasource.FileDataSource.getNiceFileName(FileDataSource.java:36)
at net.sourceforge.pmd.processor.AbstractPMDProcessor.filenameFrom(AbstractPMDProcessor.java:57)
at net.sourceforge.pmd.processor.AbstractPMDProcessor.processFiles(AbstractPMDProcessor.java:109)
at net.sourceforge.pmd.PMD.processFiles(PMD.java:311)
at net.sourceforge.pmd.PMD.doPMD(PMD.java:232)
at net.sourceforge.pmd.PMD.run(PMD.java:451)
at net.sourceforge.pmd.cli.PMDCommandLineInterface.run(PMDCommandLineInterface.java:170)
at net.sourceforge.pmd.PMD.main(PMD.java:424)
And inputFileName
parameter is null
.
Running PMD through: CLI
bin/run.sh pmd -shortnames -filelist filelist -format text -rulesets braces.xml
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4