Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connectors/http-connector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.github.openstack4j.core.connectors</groupId>
<artifactId>openstack4j-connectors</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<name>OpenStack4j HttpURL Connector</name>
<artifactId>openstack4j-http-connector</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion connectors/httpclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>com.github.openstack4j.core.connectors</groupId>
<artifactId>openstack4j-connectors</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-httpclient</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion connectors/jersey2-jakarta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>com.github.openstack4j.core.connectors</groupId>
<artifactId>openstack4j-connectors</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-jersey2-jakarta</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.client.HttpUrlConnectorProvider;
import org.glassfish.jersey.client.HttpUrlConnectorProvider.ConnectionFactory;
import org.glassfish.jersey.client.JerseyClientBuilder;
import org.glassfish.jersey.jackson.JacksonFeature;
import org.openstack4j.api.exceptions.ConnectionException;
import org.openstack4j.core.transport.ClientConstants;
Expand Down Expand Up @@ -66,8 +67,11 @@ private static Client buildClientFromConfig(Config config) {
if (config.getProxy() != null) {
addProxy(clientConfig, config);
}

ClientBuilder cb = ClientBuilder.newBuilder()
// Instantiate Jersey directly instead of ClientBuilder.newBuilder(): the JAX-RS lookup
// goes through the thread context classloader, which, when this connector runs inside an
// isolated plugin classloader, can resolve another Jersey/Jackson copy that ignores the
// Jackson annotations on our model classes (e.g. KeystoneAuth sent without its "auth" root).
ClientBuilder cb = new JerseyClientBuilder()
.withConfig(clientConfig)
.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, "true")
.register(JacksonFeature.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,21 @@ public class HttpExecutorServiceImpl implements HttpExecutorService {
*/
@Override
public <R> HttpResponse execute(HttpRequest<R> request) {
// Jersey discovers providers and initializes its client runtime lazily, using the thread
// context classloader. Pin it to this connector's classloader so that, when loaded from an
// isolated (child-first) plugin classloader, Jersey and Jackson resolve from the same copy
// as the openstack4j model classes, whatever thread makes the call.
Thread thread = Thread.currentThread();
ClassLoader previous = thread.getContextClassLoader();
thread.setContextClassLoader(HttpExecutorServiceImpl.class.getClassLoader());
try {
return invoke(request);
} catch (ResponseException re) {
throw re;
} catch (Exception e) {
throw new ConnectionException("Error during execution: " + e, 0, e);
} finally {
thread.setContextClassLoader(previous);
}
}

Expand Down
2 changes: 1 addition & 1 deletion connectors/jersey2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>com.github.openstack4j.core.connectors</groupId>
<artifactId>openstack4j-connectors</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-jersey2</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion connectors/okhttp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>com.github.openstack4j.core.connectors</groupId>
<artifactId>openstack4j-connectors</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-okhttp</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion connectors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>com.github.openstack4j.core</groupId>
<artifactId>openstack4j-parent</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.openstack4j.core.connectors</groupId>
Expand Down
2 changes: 1 addition & 1 deletion connectors/resteasy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>com.github.openstack4j.core.connectors</groupId>
<artifactId>openstack4j-connectors</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-resteasy</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core-integration-test/it-httpclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.github.openstack4j.core</groupId>
<artifactId>openstack4j-core-integration-test</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<artifactId>it-httpclient</artifactId>
<name>OpenStack4j IntegrationTest Apache HttpClient</name>
Expand Down
2 changes: 1 addition & 1 deletion core-integration-test/it-jersey2-jakarta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.github.openstack4j.core</groupId>
<artifactId>openstack4j-core-integration-test</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<artifactId>it-jersey2-jakarta</artifactId>
<name>OpenStack4j IntegrationTest Jersey2 Jakarta Connector</name>
Expand Down
2 changes: 1 addition & 1 deletion core-integration-test/it-jersey2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.github.openstack4j.core</groupId>
<artifactId>openstack4j-core-integration-test</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<artifactId>it-jersey2</artifactId>
<name>OpenStack4j IntegrationTest Jersey2 Connector</name>
Expand Down
2 changes: 1 addition & 1 deletion core-integration-test/it-okhttp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.github.openstack4j.core</groupId>
<artifactId>openstack4j-core-integration-test</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<artifactId>it-okhttp</artifactId>
<name>OpenStack4j IntegrationTest OKHttp Connector</name>
Expand Down
2 changes: 1 addition & 1 deletion core-integration-test/it-resteasy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>com.github.openstack4j.core</groupId>
<artifactId>openstack4j-core-integration-test</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<artifactId>it-resteasy</artifactId>
<name>OpenStack4j IntegrationTest RestEasy Connector</name>
Expand Down
2 changes: 1 addition & 1 deletion core-integration-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>com.github.openstack4j.core</groupId>
<artifactId>openstack4j-parent</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-core-integration-test</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>com.github.openstack4j.core</groupId>
<artifactId>openstack4j-parent</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-core-test</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>com.github.openstack4j.core</groupId>
<artifactId>openstack4j-parent</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<parent>
<groupId>com.github.openstack4j.core</groupId>
<artifactId>openstack4j-parent</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openstack4j</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.openstack4j.core</groupId>
<artifactId>openstack4j-parent</artifactId>
<version>co-3.12.4</version>
<version>co-3.12.5</version>
<name>OpenStack4j Parent</name>
<description>OpenStack Java API</description>
<url>https://github.com/openstack4j/openstack4j/</url>
Expand Down
Loading