Skip to content

Conversation

@HeikoKlare
Copy link
Contributor

When initializing the SVGFileFormat class for loading SVGs, the current context classloader is used by the ServiceLoader to find an SVGRasterizer implementation. This classloader may be incorrect in some cases, i.e., it may not be the plain system classloader or an according OSGi classloader but, e.g., some specific classloader for test execution.

This change makes the ServiceLoader use the same classloader for finding an SVGRasterizer implementation than the classloader of the SVGRasterizer class itself.

Fixes #1965

Fixes #2049

Remarks

I am not completely sure if this will always yield a "correct" classloader or whether the classloader of the SVGRasterizer may also be "wrong".

An alternative might be to force classloading of the SVGFileFormat class to happen easly in application lifecycle instead of at first usage where the current context classloader may vary.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 23, 2025

Test Results

   545 files  + 6     545 suites  +6   31m 14s ⏱️ + 3m 24s
 4 373 tests +37   4 355 ✅ +35   18 💤 +3  0 ❌  - 1 
16 634 runs  +37  16 496 ✅ +35  138 💤 +3  0 ❌  - 1 

Results for commit d64ad58. ± Comparison against base commit bfcadf9.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare marked this pull request as ready for review April 23, 2025 20:26
@HeikoKlare
Copy link
Contributor Author

@iloveeclipse can you / do you want to have a look at or maybe even try this fix for the test issue you had?

I have of course already tested with your reproducer (via WSL), in which the issue is solved.

@iloveeclipse
Copy link
Member

Tomorrow.

@iloveeclipse
Copy link
Member

But feel free to merge, looks promising.

@HeikoKlare
Copy link
Contributor Author

Thank you! Due to lack of working infrastructure, I do not plan to merge now anyway, as we don't have ECA validation, Jenkins build etc. and for this change I would like to have one Jenkins build if possible.

…eclipse-platform#2049

When initializing the SVGFileFormat class for loading SVGs, the current
context classloader is used by the ServiceLoader to find an
SVGRasterizer implementation. This classloader may be incorrect in some
cases, i.e., it may not be the plain system classloader or an according
OSGi classloader but, e.g., some specific classloader for test
execution.

This change makes the ServiceLoader use the same classloader for finding
an SVGRasterizer implementation than the classloader of the
SVGFileFormat class containing the rasterizer reference itself.

Fixes eclipse-platform#1965

Fixes eclipse-platform#2049
Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good. Great catch!
When looking at the mentioned issues I didn't thought about this at all, but it makes totally sense.

@HeikoKlare
Copy link
Contributor Author

Version increment check is failing for infrastructure reasons and no further version bump is required here.

@HeikoKlare HeikoKlare merged commit 9859aae into eclipse-platform:master Apr 24, 2025
9 of 10 checks passed
@HeikoKlare HeikoKlare deleted the issue-2049-1965 branch April 24, 2025 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SWTException: Unsupported or unrecognized format [No SVG rasterizer found] SVGRasterizer tests fail in I-Builds

5 participants