Issue Type: Bug Bug
Assignee: Unassigned
Attachments: read-properties-quiet-npe.diff
Components: properties
Created: 14/Apr/13 8:57 PM
Description:

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 );

Attached is a patch with the fix.

If is allowed to me do a question:
This plugin is still 'alive'? I mean, there are some critical bug's opened but without fixes and the version still in alpha release since years ago.
I think that the idea behind this plugin is quite useful and I will be glad in be allowed to fix the open bug's and help to promote this plugin to a stable release.

Thanks!

Environment: All
Project: Mojo
Priority: Critical Critical
Reporter: Anderson Vaz
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