You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ad...@apache.org on 2019/05/16 17:28:01 UTC

[maven-pmd-plugin] branch MPMD-288 created (now 953539f)

This is an automated email from the ASF dual-hosted git repository.

adangel pushed a change to branch MPMD-288
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git.


      at 953539f  [MPMD-288] - NullPointerException fix

This branch includes the following new commits:

     new 953539f  [MPMD-288] - NullPointerException fix

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-pmd-plugin] 01/01: [MPMD-288] - NullPointerException fix

Posted by ad...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

adangel pushed a commit to branch MPMD-288
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git

commit 953539f786645f7dea485b2beb9f41c361aa7e8f
Author: Wil <wc...@users.noreply.github.com>
AuthorDate: Fri May 10 16:57:48 2019 +0200

    [MPMD-288] - NullPointerException fix
    
    Closes #11
    
    Fixed NullPointerException
    this line throws NPE when file.list is null
    https://docs.oracle.com/javase/8/docs/api/java/io/File.html#list--
    For me this occurs on jar files like `~/.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar`
    
    Contributed by: Wil Carmon
---
 src/main/java/org/apache/maven/plugins/pmd/PmdReport.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
index f88c89a..9f76065 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
@@ -769,7 +769,9 @@ public class PmdReport
                         for ( String path : projectCompileClasspath )
                         {
                             File pathFile = new File( path );
-                            if ( !pathFile.exists() || pathFile.list().length == 0 )
+                            String[] children = pathFile.list();
+
+                            if ( !pathFile.exists() || children == null || children.length == 0 )
                             {
                                 getLog().warn( "The project " + localProject.getArtifactId()
                                     + " does not seem to be compiled. PMD results might be inaccurate." );