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++ )
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.
Madhanraj Meignanam created PAXCONSTRUCT-131
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
Affects: 1.4 Fixed in: 1.7.0 Votes: 0, Watches: 1