apache / apache/maven-filtering
PropertyUtils.getPropertyValue() NPE on absent key
- Dominant language
- Java
- Stars
- 9
- Forks
- 36
- Avg merge
- 8h 47m
- Merged PRs (30d)
- 4
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java at line 184, then trace loadPropertyFile around lines 101-104 and recursive resolution around lines 199-201. Verify the missing-key path against the existing null checks at lines 221-222; done when an absent property key no longer causes an NPE while property resolution still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 75/100