Skip to content

Commit

Permalink
No need to avoid reusing the Map object
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Dec 30, 2024
1 parent 372130f commit 2d983f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/org/apache/commons/validator/Validator.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public Validator(final ValidatorResources resources, final String formName, fina
public void clear() {
formName = null;
fieldName = null;
parameters = new HashMap<>();
parameters.clear();

This comment has been minimized.

Copy link
@pzygielo

pzygielo Dec 30, 2024

What would happen if subclass set it to null?

This comment has been minimized.

Copy link
@garydgregory

garydgregory Dec 30, 2024

Author Member

Then you'd get NPEs all over this class, not just this one method.

This comment has been minimized.

Copy link
@pzygielo

pzygielo Dec 30, 2024

What if it's set to null only just before calling clear? Previously: fine.

page = 0;
}

Expand Down

0 comments on commit 2d983f2

Please sign in to comment.