Skip to content

PropertyUtils.getPropertyValue() NPE on absent key #358

Description

@elharo

In src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java, line 184:

String v = p.getProperty(k);
// ...
while ((idx = v.indexOf("${")) >= 0) {

If the key k does not exist in properties p, v is null and v.indexOf("${") throws NullPointerException. The calling code (lines 101104 of loadPropertyFile) iterates over fileProps.keySet() and passes each key with combinedProps which should contain that key. However, the recursive resolution at lines 199201 could extract a key name not present in combinedProps though that path is guarded by null checks (lines 221222). The initial call is safe in practice, but the method lacks a null guard for v at the entry point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions