maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [maven-pmd-plugin] wcarmon commented on a change in pull request #11: Fixed NullPointerException
Date Sat, 11 May 2019 20:08:28 GMT
wcarmon commented on a change in pull request #11: Fixed NullPointerException
URL: https://github.com/apache/maven-pmd-plugin/pull/11#discussion_r283109917
 
 

 ##########
 File path: src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
 ##########
 @@ -769,7 +769,7 @@ private void configureTypeResolution( PMDConfiguration configuration
) throws Ma
                         for ( String path : projectCompileClasspath )
                         {
                             File pathFile = new File( path );
-                            if ( !pathFile.exists() || pathFile.list().length == 0 )
+                            if ( !pathFile.exists() || pathFile.list() == null || pathFile.list().length
== 0 )
 
 Review comment:
   I'm not following/understanding your feedback.
   
   If the second clause is `true`, the third clause never executes.
   
   If the second clause is `false`, the third clause won't throw an NPE.
   
   Can you suggest code that is better for this?  (Or describe why a local variable is better?)

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message