adangel commented on a change in pull request #11: MPMD-288 Fixed 
NullPointerException
URL: https://github.com/apache/maven-pmd-plugin/pull/11#discussion_r284819272
 
 

 ##########
 File path: src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
 ##########
 @@ -769,7 +769,9 @@ private void configureTypeResolution( PMDConfiguration 
configuration ) throws Ma
                         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 )
 
 Review comment:
   @wcarmon I think, the logic should actually be 
   
   ```suggestion
                               if ( !pathFile.exists() || ( children != null && 
children.length == 0 ) )
   ```
   
   However, I'm wondering how a jar file can end up in this place. I expected 
here something like the paths "project-a/target/classes" or 
"project-a/target/generated-classes" or so.
   
   You've mentioned, you get the null pointer when path is 
`~/.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar`.
 Do you use log4j-api as a normal dependency or is there something special in 
your project?
   
   I've for now squashed and pushed your change to a new branch, let's see what 
Jenkins says: 
https://builds.apache.org/view/M-R/view/Maven/job/maven-box/job/maven-pmd-plugin/job/MPMD-288/

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to