[jboss-jira] [JBoss JIRA] (JBEE-185) Wrong class loading strategy used in jboss-jaxrs-api_spec
David Lloyd (JIRA)
issues at jboss.org
Fri Jan 19 13:47:00 EST 2018
David Lloyd created JBEE-185:
--------------------------------
Summary: Wrong class loading strategy used in jboss-jaxrs-api_spec
Key: JBEE-185
URL: https://issues.jboss.org/browse/JBEE-185
Project: JBoss JavaEE Spec APIs
Issue Type: Bug
Components: jboss-jaxrs-api
Reporter: David Lloyd
Assignee: Scott Marlow
The commit here: https://github.com/jboss/jboss-jaxrs-api_spec/commit/b578e70dd99a427758df7991c6456e40298d1dd0
...contains a wrong strategy for locating an API's implementation module. The strategy used is to use reflection to try and find a fixed module name from a module repository, but this is brittle and unnecessary.
The correct strategy is to use your own class loader, like this:
{code:java}
// allowed with secmgr check because caller is the class in question
ClassLoader myClassLoader = MyClass.class.getClassLoader();
try (InputStream is = myClassLoader.getResourceAsStream(serviceId)) {
// ...
} catch (IOException ex) {
// ...
}
{code}
In the WildFly code, the JAX-RS API module should depend on the implementation module (probably with {{services="import"}}).
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jboss-jira
mailing list