Skip to content

Commit

Permalink
Address FAT test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-krueger committed Oct 3, 2024
1 parent 486a4f2 commit 8bc7741
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 50 deletions.
3 changes: 2 additions & 1 deletion dev/io.openliberty.org.jboss.resteasy.common.ee10/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ Include-Resource:\
com.ibm.ws.kernel.service,\
io.openliberty.webcontainer.security.internal,\
com.ibm.websphere.security,\
com.ibm.ws.org.jboss.jandex
com.ibm.ws.org.jboss.jandex,\
org.eclipse.osgi

-testpath: \
../build.sharedResources/lib/junit/old/junit.jar;version=file,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.Set;
import java.util.concurrent.CompletionStage;

import org.eclipse.osgi.internal.loader.EquinoxClassLoader;
import jakarta.ws.rs.container.ResourceInfo;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.ext.Providers;
Expand Down Expand Up @@ -202,20 +203,28 @@ protected Object createProxy() {
throw new RuntimeException(e);
}
} else {
// Liberty change start
Class<?>[] intfs;
Object delegate = factory.getContextData(rawType, genericType, annotations, false);
Class<?>[] intfs = computeInterfaces(delegate, rawType);
if (delegate != null &&
((rawType.getName().startsWith("org.jboss.resteasy")) ||
(!(delegate.getClass().getClassLoader() instanceof EquinoxClassLoader)))) {
intfs = computeInterfaces(delegate, rawType);
} else {
intfs = computeInterfaces(null, rawType);
}
// Liberty change end
ClassLoader clazzLoader = null;
final SecurityManager sm = System.getSecurityManager();
if (sm == null) {
// liberty change - use this classloader
clazzLoader = delegate == null ? rawType.getClassLoader() : delegate.getClass().getClassLoader();
// The class loader may be null for primitives, void or the type was loaded from the bootstrap class loader.
// In such cases we should use the TCCL.
if (clazzLoader == null) {
clazzLoader = Thread.currentThread().getContextClassLoader();
}
if (clazzLoader == null) {
clazzLoader = this.getClass().getClassLoader();
clazzLoader = this.getClass().getClassLoader(); //liberty change
}
} else {
clazzLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
Expand Down
69 changes: 35 additions & 34 deletions dev/io.openliberty.org.jboss.resteasy.common.ee11/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -198,40 +198,41 @@ Include-Resource:\
META-INF=resources/META-INF

-buildpath: \
org.jboss.resteasy:resteasy-client-api;strategy=exact;version='${resteasy-version}',\
org.jboss.resteasy:resteasy-client;strategy=exact;version='${resteasy-version}',\
org.jboss.resteasy:resteasy-core-spi;strategy=exact;version='${resteasy-version}',\
org.jboss.resteasy:resteasy-core;strategy=exact;version='${resteasy-version}',\
org.jboss.resteasy:resteasy-multipart-provider;strategy=exact;version='${resteasy-version}',\
org.jboss.resteasy:resteasy-tracing-api;strategy=exact;version='${resteasy-tracing-api-version}',\
org.apache.james:apache-mime4j-core;strategy=exact;version='${apache-mime4j-version}',\
org.apache.james:apache-mime4j-dom;strategy=exact;version='${apache-mime4j-version}',\
org.apache.james:apache-mime4j-storage;strategy=exact;version='${apache-mime4j-version}',\
io.openliberty.jakarta.restfulWS.4.0,\
io.openliberty.jakarta.activation.2.1,\
io.openliberty.jakarta.servlet.6.1,\
io.openliberty.jakarta.annotation.3.0,\
io.openliberty.jakarta.jsonp.2.1,\
io.openliberty.jakarta.cdi.4.1,\
com.ibm.ws.org.apache.commons.io,\
com.ibm.ws.org.apache.httpcomponents,\
io.openliberty.org.eclipse.microprofile.config.3.0;version=latest,\
com.ibm.websphere.org.osgi.service.component;version=latest,\
com.ibm.websphere.org.reactivestreams.reactive-streams.1.0;version=latest,\
com.ibm.ws.adaptable.module;version=latest,\
com.ibm.ws.classloading;version=latest,\
com.ibm.ws.container.service;version=latest,\
com.ibm.ws.container.service.compat;version=latest,\
com.ibm.ws.logging.core,\
com.ibm.ws.threading,\
io.openliberty.org.jboss.logging35,\
com.ibm.ws.org.osgi.annotation.versioning;version=latest,\
com.ibm.wsspi.org.osgi.service.component.annotations;version=latest,\
com.ibm.websphere.org.osgi.core;version=latest,\
com.ibm.ws.kernel.service,\
io.openliberty.webcontainer.security.internal,\
com.ibm.websphere.security,\
com.ibm.ws.org.jboss.jandex
org.jboss.resteasy:resteasy-client-api;strategy=exact;version='${resteasy-version}',\
org.jboss.resteasy:resteasy-client;strategy=exact;version='${resteasy-version}',\
org.jboss.resteasy:resteasy-core-spi;strategy=exact;version='${resteasy-version}',\
org.jboss.resteasy:resteasy-core;strategy=exact;version='${resteasy-version}',\
org.jboss.resteasy:resteasy-multipart-provider;strategy=exact;version='${resteasy-version}',\
org.jboss.resteasy:resteasy-tracing-api;strategy=exact;version='${resteasy-tracing-api-version}',\
org.apache.james:apache-mime4j-core;strategy=exact;version='${apache-mime4j-version}',\
org.apache.james:apache-mime4j-dom;strategy=exact;version='${apache-mime4j-version}',\
org.apache.james:apache-mime4j-storage;strategy=exact;version='${apache-mime4j-version}',\
io.openliberty.jakarta.restfulWS.4.0,\
io.openliberty.jakarta.activation.2.1,\
io.openliberty.jakarta.servlet.6.1,\
io.openliberty.jakarta.annotation.3.0,\
io.openliberty.jakarta.jsonp.2.1,\
io.openliberty.jakarta.cdi.4.1,\
com.ibm.ws.org.apache.commons.io,\
com.ibm.ws.org.apache.httpcomponents,\
io.openliberty.org.eclipse.microprofile.config.3.0;version=latest,\
com.ibm.websphere.org.osgi.service.component;version=latest,\
com.ibm.websphere.org.reactivestreams.reactive-streams.1.0;version=latest,\
com.ibm.ws.adaptable.module;version=latest,\
com.ibm.ws.classloading;version=latest,\
com.ibm.ws.container.service;version=latest,\
com.ibm.ws.container.service.compat;version=latest,\
com.ibm.ws.logging.core,\
com.ibm.ws.threading,\
io.openliberty.org.jboss.logging35,\
com.ibm.ws.org.osgi.annotation.versioning;version=latest,\
com.ibm.wsspi.org.osgi.service.component.annotations;version=latest,\
com.ibm.websphere.org.osgi.core;version=latest,\
com.ibm.ws.kernel.service,\
io.openliberty.webcontainer.security.internal,\
com.ibm.websphere.security,\
com.ibm.ws.org.jboss.jandex,\
org.eclipse.osgi

-testpath: \
../build.sharedResources/lib/junit/old/junit.jar;version=file,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
import java.util.Set;
import java.util.concurrent.CompletionStage;

import org.eclipse.osgi.internal.loader.EquinoxClassLoader;

import jakarta.ws.rs.container.ResourceInfo;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.ext.Providers;
import jakarta.ws.rs.sse.Sse;
import jakarta.ws.rs.sse.SseEventSink;

import org.jboss.resteasy.plugins.providers.sse.SseImpl;
import org.jboss.resteasy.plugins.server.servlet.ResteasyContextParameters;
import org.jboss.resteasy.resteasy_jaxrs.i18n.Messages;
Expand Down Expand Up @@ -202,20 +203,28 @@ protected Object createProxy() {
throw new RuntimeException(e);
}
} else {
// Liberty change start
Class<?>[] intfs;
Object delegate = factory.getContextData(rawType, genericType, annotations, false);
Class<?>[] intfs = computeInterfaces(delegate, rawType);
if (delegate != null &&
((rawType.getName().startsWith("org.jboss.resteasy")) ||
(!(delegate.getClass().getClassLoader() instanceof EquinoxClassLoader)))) {
intfs = computeInterfaces(delegate, rawType);
} else {
intfs = computeInterfaces(null, rawType);
}
// Liberty change end
ClassLoader clazzLoader = null;
final SecurityManager sm = System.getSecurityManager();
if (sm == null) {
// liberty change - use this classloader
clazzLoader = delegate == null ? rawType.getClassLoader() : delegate.getClass().getClassLoader();
// The class loader may be null for primitives, void or the type was loaded from the bootstrap class loader.
// In such cases we should use the TCCL.
if (clazzLoader == null) {
clazzLoader = Thread.currentThread().getContextClassLoader();
}
if (clazzLoader == null) {
clazzLoader = this.getClass().getClassLoader();
clazzLoader = this.getClass().getClassLoader(); //liberty change
}
} else {
clazzLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
Expand All @@ -228,8 +237,9 @@ public ClassLoader run() {
result = Thread.currentThread().getContextClassLoader();
}
if (result == null) {
result = this.getClass().getClassLoader(); //liberty change
result = this.getClass().getClassLoader(); //liberty change
}

return result;
}
});
Expand Down
3 changes: 2 additions & 1 deletion dev/io.openliberty.org.jboss.resteasy.common/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ Include-Resource:\
com.ibm.wsspi.org.osgi.service.component.annotations;version=latest,\
javax.activation:activation;version=1.1,\
com.ibm.websphere.appserver.api.basics,\
com.ibm.ws.kernel.service
com.ibm.ws.kernel.service,\
org.eclipse.osgi

-testpath: \
../build.sharedResources/lib/junit/old/junit.jar;version=file,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.jboss.resteasy.spi.ValueInjector;
import org.jboss.resteasy.spi.util.Types;

import org.eclipse.osgi.internal.loader.EquinoxClassLoader;
import javax.ws.rs.container.ResourceInfo;
import javax.ws.rs.core.Application;
import javax.ws.rs.ext.Providers;
Expand Down Expand Up @@ -216,23 +217,29 @@ protected Object createProxy()
{
throw new RuntimeException(e);
}
}
else
{
} else {
// Liberty change start
Class<?>[] intfs;
Object delegate = factory.getContextData(rawType, genericType, annotations, false);
Class<?>[] intfs = computeInterfaces(delegate, rawType);
if (delegate != null &&
((rawType.getName().startsWith("org.jboss.resteasy")) ||
(!(delegate.getClass().getClassLoader() instanceof EquinoxClassLoader)))) {
intfs = computeInterfaces(delegate, rawType);
} else {
intfs = computeInterfaces(null, rawType);
}
// Liberty change end
ClassLoader clazzLoader = null;
final SecurityManager sm = System.getSecurityManager();
if (sm == null) {
// liberty change - use this classloader
clazzLoader = delegate == null ? rawType.getClassLoader() : delegate.getClass().getClassLoader();
// The class loader may be null for primitives, void or the type was loaded from the bootstrap class loader.
// In such cases we should use the TCCL.
if (clazzLoader == null) {
clazzLoader = Thread.currentThread().getContextClassLoader();
}
if (clazzLoader == null) {
clazzLoader = this.getClass().getClassLoader();
clazzLoader = this.getClass().getClassLoader(); //liberty change
}
} else {
clazzLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
Expand Down

0 comments on commit 8bc7741

Please sign in to comment.