christianAppl commented on PR #158: URL: https://github.com/apache/poi-xmlbeans/pull/158#issuecomment-6626006159
@pjfanning Thanks for the review. I pushed 7ad22c7, which changes only the test: 1. **Errors are no longer swallowed.** Each thread records any `Throwable` in an `AtomicReference`, `Error`s included: a failed class initialization throws `ExceptionInInitializerError` and a missing class `NoClassDefFoundError`, which the old `catch (Exception e)` did not catch at all. After the joins, the test fails with the recorded throwable as the cause, naming the attempt and the entry point. With a wrong class name for the generated type, the previous version passed, with and without the fix; now it fails on the first attempt. 2. **The class loader is closed** after every attempt in which neither thread hung. A stuck attempt keeps its loader, and the test fails on that attempt anyway. 3. **10 attempts instead of 20.** Without the fix, 9 of 20 attempts hung in one JVM, so the chance that 10 attempts all pass despite a regression is about 0.55^10 ≈ 0.25 %. With the fix, the test takes about a second here. 4. **Class path versus module path:** with the change from point 1, a module-path setup would show up as a failure instead of a silent pass, so I left the class path lookup as it is. How it was checked: the test was compiled from the branch and run against xmlbeans-5.4.1.jar on JDK 21. With the fix in `SchemaTypeLoaderBase` it passed 3 times out of 3; without it, it failed 3 times out of 3, hanging at attempt 1 or 2; with a wrong class name it failed at once. I could not run the Gradle build locally, so a `gradlew test --tests misc.detailed.StaticInitializationRingTest` run before merging would confirm it in the project's build. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
