Anderson Vaz edited a comment on Improvement MOJO-1316

There is a bug in the implementation of the functionality <quiet/>. If you use a variable interpolation that resolves to null (or empty string) even with <quiet>true</quiet> the plugin raise a NPE, example:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<ignoreResourceNotFound>true</ignoreResourceNotFound>
<files>
<file>some/location/application.properties</file>
<file>${custom-properties}<file>
</files>
</configuration>
</plugin>

If 'custom-properties' variable resolves to nothing, a NPE is raised. It occurs because the ReadPropertiesMojo.java doesn't test for null of the file object in the line 76 as follows:

ReadPropertiesMojo.java

   if ( file.exists() )

Even in the line 106 of the same file, that try to warn about the missing file, a NPE could be raised because the file object is null and the method try to get the absolute path of that file object:

ReadPropertiesMojo.java

   throw new MojoExecutionException( "Error reading properties file " + file.getAbsolutePath(), e );

I will open an issue and attach a patch to address this bug's.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to