Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maven-pax-plugin throws NPE [PAXCONSTRUCT-131] #143

Open
ops4j-issues opened this issue Dec 9, 2009 · 1 comment
Open

maven-pax-plugin throws NPE [PAXCONSTRUCT-131] #143

ops4j-issues opened this issue Dec 9, 2009 · 1 comment
Labels
Milestone

Comments

@ops4j-issues
Copy link

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

@ops4j-issues
Copy link
Author

Andreas Pieber commented

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

@ops4j-issues ops4j-issues added this to the 1.7.0 milestone Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant