[java] fix loading "isDisplayed.js" and other resources in OSGI environment#17257
Conversation
Review Summary by QodoFix resource loading in OSGi environment by using resource owner class
WalkthroughsDescription• Fix resource loading in OSGi environment by using resource owner class • Deprecate single-argument resourceAsString() method • Add new overloaded resourceAsString(Class, String) method • Update all callers to pass resource owner class parameter File Changes1. java/src/org/openqa/selenium/io/Read.java
|
Code Review by Qodo
1. resourceAsString missing null checks
|
…OSGI environment In OSGi, each bundle has its own classloader that can only see its own resources. `Read.class.getResource(...)` uses the classloader of the bundle containing class `Read`. It would not find resource "isDisplayed.js" since it's located in another bundle. The right solution is to use a class from the bundle that owns the resource.
22377d6 to
277af8e
Compare
In OSGi, each bundle has its own classloader that can only see its own resources.
🔗 Related Issues
Fixes #17251
🔧 Implementation Notes
Read.class.getResource(...)uses the classloader of the bundle containing classRead. It would not find resource "isDisplayed.js" since it's located in another bundle. The right solution is to use a class from the bundle that owns the resource.🔄 Types of changes