arturobernalg opened a new pull request, #13596: URL: https://github.com/apache/maven/pull/13596
Backport of #11734 to maven-3.10.x. `DefaultModelValidator` is a singleton, but its `validIds` field is a plain `HashSet` on this branch, which several threads can mutate during model validation, for instance with the breadth-first dependency collector. A concurrent restructuring of the `HashMap` behind it can make a reader fail with a `ClassCastException` (#11618). The field is now `ConcurrentHashMap.newKeySet()`, as on master and on maven-4.0.x, and a `null` id is no longer looked up in it. The main change applied after adapting the module path. The test `testConcurrentValidation` was added by hand to the existing test class. It is a regression guard, and like the original it does not fail reliably without the change, because the race is timing dependent. `maven-model-builder` and its dependencies pass (207 tests) and spotless is clean. I did not run the integration tests. --- To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) check one of the following: - [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) - [x] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
