-
Notifications
You must be signed in to change notification settings - Fork 187
Use proper classloader for finding SVGRasterizer #1965 #2049 #2055
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use proper classloader for finding SVGRasterizer #1965 #2049 #2055
Conversation
|
@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. |
|
Tomorrow. |
|
But feel free to merge, looks promising. |
|
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. |
bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/internal/image/SVGFileFormat.java
Outdated
Show resolved
Hide resolved
79f33c0 to
93e6c4f
Compare
…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
93e6c4f to
d64ad58
Compare
HannesWell
left a comment
There was a problem hiding this 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.
|
Version increment check is failing for infrastructure reasons and no further version bump is required here. |
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
SVGRasterizermay also be "wrong".An alternative might be to force classloading of the
SVGFileFormatclass to happen easly in application lifecycle instead of at first usage where the current context classloader may vary.