You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@creadur.apache.org by "huangxiaopingRD (via GitHub)" <gi...@apache.org> on 2025/12/29 11:49:31 UTC

[PR] RAT-531: Fix NPE on families is null [creadur-rat]

huangxiaopingRD opened a new pull request, #602:
URL: https://github.com/apache/creadur-rat/pull/602

   Fix NPE on families is null
   
   `
   Caused by: java.lang.NullPointerException: Cannot read the array length because "this.families" is null
       at org.apache.rat.mp.AbstractRatMojo.getConfiguration (AbstractRatMojo.java:508)
       at org.apache.rat.mp.RatCheckMojo.getConfiguration (RatCheckMojo.java:166)
       at org.apache.rat.mp.RatCheckMojo.execute (RatCheckMojo.java:205)
       at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
       at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
       at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
       at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
       at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
       at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
       at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
       at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
       at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
       at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
       at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
       at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
       at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
       at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
       at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
       at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
       at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke (Method.java:569)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
       at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
       at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
       at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
   `


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RAT-531: Fix NPE on families is null [creadur-rat]

Posted by "huangxiaopingRD (via GitHub)" <gi...@apache.org>.
huangxiaopingRD commented on code in PR #602:
URL: https://github.com/apache/creadur-rat/pull/602#discussion_r2664781502


##########
apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java:
##########
@@ -504,7 +504,7 @@ protected ReportConfiguration getConfiguration() throws MojoExecutionException {
                     }
                 }
                 if (families != null || getDeprecatedConfigs().findAny().isPresent()) {
-                    if (log.isEnabled(Log.Level.DEBUG)) {
+                    if (log.isEnabled(Log.Level.DEBUG) && families != null) {

Review Comment:
   @ottlinger Thanks for your help and review.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RAT-531: Fix NPE on families is null [creadur-rat]

Posted by "huangxiaopingRD (via GitHub)" <gi...@apache.org>.
huangxiaopingRD commented on code in PR #602:
URL: https://github.com/apache/creadur-rat/pull/602#discussion_r2664261564


##########
apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java:
##########
@@ -504,7 +504,7 @@ protected ReportConfiguration getConfiguration() throws MojoExecutionException {
                     }
                 }
                 if (families != null || getDeprecatedConfigs().findAny().isPresent()) {
-                    if (log.isEnabled(Log.Level.DEBUG)) {
+                    if (log.isEnabled(Log.Level.DEBUG) && families != null) {

Review Comment:
   I've verified that adding this change makes the RAT plugin work correctly without any NPEs. The cause of the NPE was a data file in the project that lacked an Apache License.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RAT-531: Fix NPE on families is null [creadur-rat]

Posted by "huangxiaopingRD (via GitHub)" <gi...@apache.org>.
huangxiaopingRD commented on code in PR #602:
URL: https://github.com/apache/creadur-rat/pull/602#discussion_r2664261564


##########
apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java:
##########
@@ -504,7 +504,7 @@ protected ReportConfiguration getConfiguration() throws MojoExecutionException {
                     }
                 }
                 if (families != null || getDeprecatedConfigs().findAny().isPresent()) {
-                    if (log.isEnabled(Log.Level.DEBUG)) {
+                    if (log.isEnabled(Log.Level.DEBUG) && families != null) {

Review Comment:
   I've verified that adding this change makes the RAT plugin work correctly without any NPEs. The cause of the NPE was a data [file](https://github.com/apache/hudi/blob/master/hudi-common/src/test/resources/format/delete-block-v2-content-10-records.data) in the project that lacked an Apache License. Currently, I'm avoiding NPE by excluding this file from the check.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RAT-531: Fix NPE on families is null [creadur-rat]

Posted by "huangxiaopingRD (via GitHub)" <gi...@apache.org>.
huangxiaopingRD commented on code in PR #602:
URL: https://github.com/apache/creadur-rat/pull/602#discussion_r2664261564


##########
apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java:
##########
@@ -504,7 +504,7 @@ protected ReportConfiguration getConfiguration() throws MojoExecutionException {
                     }
                 }
                 if (families != null || getDeprecatedConfigs().findAny().isPresent()) {
-                    if (log.isEnabled(Log.Level.DEBUG)) {
+                    if (log.isEnabled(Log.Level.DEBUG) && families != null) {

Review Comment:
   I've verified that adding this change makes the RAT plugin work correctly without any NPEs. The cause of the NPE was a data file in the project that lacked an Apache License. Currently, I'm avoiding NPE by excluding this file from the check.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RAT-531: Fix NPE on families is null [creadur-rat]

Posted by "ottlinger (via GitHub)" <gi...@apache.org>.
ottlinger commented on code in PR #602:
URL: https://github.com/apache/creadur-rat/pull/602#discussion_r2655500561


##########
apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java:
##########
@@ -504,7 +504,7 @@ protected ReportConfiguration getConfiguration() throws MojoExecutionException {
                     }
                 }
                 if (families != null || getDeprecatedConfigs().findAny().isPresent()) {
-                    if (log.isEnabled(Log.Level.DEBUG)) {
+                    if (log.isEnabled(Log.Level.DEBUG) && families != null) {

Review Comment:
   You are running into this NPE due to wrong configuration as the if in line 506 indicates - the families null check is applied but due to the deprecated configuration options this line is entered :)



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RAT-531: Fix NPE on families is null [creadur-rat]

Posted by "huangxiaopingRD (via GitHub)" <gi...@apache.org>.
huangxiaopingRD commented on code in PR #602:
URL: https://github.com/apache/creadur-rat/pull/602#discussion_r2664645321


##########
apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java:
##########
@@ -504,7 +504,7 @@ protected ReportConfiguration getConfiguration() throws MojoExecutionException {
                     }
                 }
                 if (families != null || getDeprecatedConfigs().findAny().isPresent()) {
-                    if (log.isEnabled(Log.Level.DEBUG)) {
+                    if (log.isEnabled(Log.Level.DEBUG) && families != null) {

Review Comment:
   The file is [delete-block-v2-content-10-records.data](https://github.com/apache/hudi/blob/master/hudi-common/src/test/resources/format/delete-block-v2-content-10-records.data).
   
   Patch [RAT-531](https://issues.apache.org/jira/browse/RAT-531)  will cause new errors because the Hudi project contains many different Apache License texts.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RAT-531: Fix NPE on families is null [creadur-rat]

Posted by "ottlinger (via GitHub)" <gi...@apache.org>.
ottlinger commented on code in PR #602:
URL: https://github.com/apache/creadur-rat/pull/602#discussion_r2664770384


##########
apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java:
##########
@@ -504,7 +504,7 @@ protected ReportConfiguration getConfiguration() throws MojoExecutionException {
                     }
                 }
                 if (families != null || getDeprecatedConfigs().findAny().isPresent()) {
-                    if (log.isEnabled(Log.Level.DEBUG)) {
+                    if (log.isEnabled(Log.Level.DEBUG) && families != null) {

Review Comment:
   fyi: Fix will become part of the upcoming release 0.18.



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RAT-531: Fix NPE on families is null [creadur-rat]

Posted by "ottlinger (via GitHub)" <gi...@apache.org>.
ottlinger merged PR #602:
URL: https://github.com/apache/creadur-rat/pull/602


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RAT-531: Fix NPE on families is null [creadur-rat]

Posted by "ottlinger (via GitHub)" <gi...@apache.org>.
ottlinger commented on code in PR #602:
URL: https://github.com/apache/creadur-rat/pull/602#discussion_r2655591878


##########
apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java:
##########
@@ -504,7 +504,7 @@ protected ReportConfiguration getConfiguration() throws MojoExecutionException {
                     }
                 }
                 if (families != null || getDeprecatedConfigs().findAny().isPresent()) {
-                    if (log.isEnabled(Log.Level.DEBUG)) {
+                    if (log.isEnabled(Log.Level.DEBUG) && families != null) {

Review Comment:
   Did you verify if you run into other exceptions with that change? I suspect that it only lets you stumble into the next exception .... thx



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RAT-531: Fix NPE on families is null [creadur-rat]

Posted by "ottlinger (via GitHub)" <gi...@apache.org>.
ottlinger commented on PR #602:
URL: https://github.com/apache/creadur-rat/pull/602#issuecomment-3714599612

   Merging as GHA seems to have basic infra problems (unable to download artifacts)


-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RAT-531: Fix NPE on families is null [creadur-rat]

Posted by "ottlinger (via GitHub)" <gi...@apache.org>.
ottlinger commented on code in PR #602:
URL: https://github.com/apache/creadur-rat/pull/602#discussion_r2664285292


##########
apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java:
##########
@@ -504,7 +504,7 @@ protected ReportConfiguration getConfiguration() throws MojoExecutionException {
                     }
                 }
                 if (families != null || getDeprecatedConfigs().findAny().isPresent()) {
-                    if (log.isEnabled(Log.Level.DEBUG)) {
+                    if (log.isEnabled(Log.Level.DEBUG) && families != null) {

Review Comment:
   Thanks - Can you point me to the file that triggers the error? Did my patch file (attached to RAT-531) help you in migrating to the newer RAT version?



-- 
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.

To unsubscribe, e-mail: dev-unsubscribe@creadur.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org