maven-pax-plugin throws NPE

Description

We are using maven-pax-plugin to read some of the POM properties during maven build that uses our custom maven plugin. the maven-pax-plugin throws an NPE in certain instances:

java.lang.NullPointerException
[exec] at java.util.Hashtable.put(Hashtable.java:775)
[exec] at java.util.Properties.setProperty(Properties.java:563)
[exec] at org.ops4j.pax.construct.util.XppPom.getProperties(XppPom.java:671)

The following method in rg.ops4j.pax.construct.util.XppPom

public Properties getProperties()
{
Properties properties = new Properties();

Xpp3Dom map = m_pom.getChild( "properties" );
if( null != map )
{
Xpp3Dom[] entries = map.getChildren();
for( int i = 0; i < entries.length; i++ )
{
properties.setProperty( entries[i].getName(), entries[i].getValue() );
}
}

return properties;
}

needs to be changed to have the NULL check:

....
if (null != map) {
Xpp3Dom[] entries = map.getChildren();
for (int i = 0; i < entries.length; i++) {
if (entries[i].getName() != null
&& entries[i].getValue() != null)
properties.setProperty(entries[i].getName(), entries[i]
.getValue());
}
}
...

We have extended this class and overridden the getProperties method to workaround this issue. Also, we had to use reflection to access some of the members that are not visible.

Please let me know if any more information is needed.

Thanks,
Madhan

Environment

Windows 2003 Server, Standard 64 bit edition SP2, Maven 2.0.9

Activity

Show:
Andreas Pieber
February 4, 2011, 8:33 AM

I've no idea if this is still a valid problem, but since 1.4 is already released I've moved it to 1.5

Assignee

Unassigned

Reporter

Madhanraj Meignanam

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure