[MAGNOLIA-7601] ClasspathResourcesUtil refactoring Created: 12/Aug/19  Updated: 29/Oct/21  Resolved: 28/Sep/21

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2.13

Type: Improvement Priority: Neutral
Reporter: Mercedes Iruela Assignee: Michael Duerig
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
causes MAGNOLIA-8193 Repository is not cleaned up post tes... Closed
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:
Epic Link: Build on JDK11+

 Description   

ClasspathResourcesUtil may not collect the expected resources on Java 9+.
This issue may affect execution of tests, where the bootstrap files are not detected properly, and need to be added manually to the tests.

Since JDK9, the system class loaders are no longer URLClassLoaders. This becomes a problem when running tests or scripts standalone on Java 11 for example (either from Maven or from IntelliJ). It is not a problem at Magnolia runtime because there we are under Tomcat's WebappClassLoader (or similar for others) which still is a URLClassLoader.

Fix should be along the lines of tokenizing the classpath and producing URLs out of that, no unsafe reflection involved.



 Comments   
Comment by Michael Duerig [ 27/Sep/21 ]

Resources are made available for running tests by scanning the individual class path entries should the class loader not be an instance of URLClassLoader

Generated at Mon Feb 12 04:25:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.