Skip to content
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

merge actual master into 3.1 #4958

Merged
merged 5 commits into from
Jan 8, 2022
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -56,7 +56,9 @@
import org.glassfish.jersey.internal.LocalizationMessages;
import org.glassfish.jersey.internal.OsgiRegistry;
import org.glassfish.jersey.internal.util.collection.ClassTypePair;

import org.glassfish.jersey.internal.util.collection.LazyValue;
import org.glassfish.jersey.internal.util.collection.Value;
import org.glassfish.jersey.internal.util.collection.Values;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;

Expand Down Expand Up @@ -1469,22 +1471,25 @@ private static boolean checkTypeBounds(final Class type, final Type[] bounds) {

private static final Class<?> bundleReferenceClass = AccessController.doPrivileged(
classForNamePA("org.osgi.framework.BundleReference", null));

/**
* Returns an {@link OsgiRegistry} instance.
*
* @return an {@link OsgiRegistry} instance or {@code null} if the class cannot be instantiated (not in OSGi environment).
*/
public static OsgiRegistry getOsgiRegistryInstance() {
private static final LazyValue<Object> osgiInstance = Values.lazy((Value<Object>) () -> {
try {
if (bundleReferenceClass != null) {
return OsgiRegistry.getInstance();
}
} catch (final Exception e) {
} catch (final Throwable e) {
// Do nothing - instance is null.
}

return null;
});

/**
* Returns an {@link OsgiRegistry} instance.
*
* @return an {@link OsgiRegistry} instance or {@code null} if the class cannot be instantiated (not in OSGi environment).
*/
public static OsgiRegistry getOsgiRegistryInstance() {
return (OsgiRegistry) osgiInstance.get();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -122,6 +122,11 @@ public List<Option> genericOsgiOptions() {

// do not remove the following line
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("FINEST"),

JdkVersion.getJdkVersion().getMajor() > 16
? vmOption("--add-opens=java.base/java.net=ALL-UNNAMED")
: null,

// uncomment the following 4 lines should you need to debug from th felix console
// mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.gogo.runtime").version(gogoVersion),
// mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.gogo.shell").version(gogoVersion),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -47,6 +47,7 @@
import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.systemPackage;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import static org.ops4j.pax.exam.CoreOptions.vmOption;

/**
* @author Jakub Podlesak
Expand Down Expand Up @@ -90,6 +91,10 @@ public List<Option> genericOsgiOptions() {
systemProperty(JAXRS_RUNTIME_DELEGATE_PROPERTY).value("org.glassfish.jersey.internal.RuntimeDelegateImpl"),
systemProperty(JAXRS_CLIENT_BUILDER).value("org.glassfish.jersey.client.JerseyClientBuilder"),

JdkVersion.getJdkVersion().getMajor() > 16
? vmOption("--add-opens=java.base/java.net=ALL-UNNAMED")
: null,

// do not remove the following line
// systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("FINEST"),

Expand Down
24 changes: 23 additions & 1 deletion ext/microprofile/mp-config/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2019, 2021 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -83,5 +83,27 @@
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<inherited>true</inherited>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>
org.glassfish.jersey.microprofile.config.*;version=${project.version}
</Export-Package>
<Import-Package>
org.eclipse.microprofile.config.*;version="!",
*
</Import-Package>
</instructions>
<unpackBundle>true</unpackBundle>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -27,6 +27,8 @@

import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
import org.glassfish.jersey.grizzly2.servlet.GrizzlyWebContainerFactory;
import org.glassfish.jersey.internal.Version;
import org.glassfish.jersey.internal.util.JdkVersion;
import org.glassfish.jersey.osgi.test.util.Helper;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.ServerProperties;
Expand All @@ -41,10 +43,9 @@
import org.ops4j.pax.exam.junit.PaxExam;
import static org.junit.Assert.assertEquals;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.vmOption;

/**
* NOTE: This test is excluded on JDK6 as it requires Servlet 3.1 API that is built against JDK 7.
*
* @author Jakub Podlesak
* @author Michal Gajdos
*/
Expand All @@ -64,6 +65,9 @@ public static Option[] configuration() {

options.addAll(Helper.expandedList(
// vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
JdkVersion.getJdkVersion().getMajor() > 16
? vmOption("--add-opens=java.base/java.net=ALL-UNNAMED")
: null,

mavenBundle().groupId("org.glassfish.jersey.media").artifactId("jersey-media-sse").versionAsInProject(),

Expand Down