Skip to content

Commit

Permalink
upstream: b=main,r=48e6a2cb8a9170eb249958cf3b58a4b58ffecbac,t=2024-05…
Browse files Browse the repository at this point in the history
…-03-1242-44277
  • Loading branch information
sonatype-zion committed May 3, 2024
1 parent 7b08c2f commit 18d4727
Show file tree
Hide file tree
Showing 39 changed files with 596 additions and 320 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@ run() {
launch "${JAVA}" ${JAVA_OPTS} \
--add-reads=java.xml=java.logging \
--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED \
--patch-module java.base=${KARAF_HOME}/lib/endorsed/org.apache.karaf.specs.locator-4.3.9.jar \
--patch-module java.xml=${KARAF_HOME}/lib/endorsed/org.apache.karaf.specs.java.xml-4.3.9.jar \
--patch-module java.base=${KARAF_HOME}/lib/endorsed/org.apache.karaf.specs.locator-4.4.2.jar \
--patch-module java.xml=${KARAF_HOME}/lib/endorsed/org.apache.karaf.specs.java.xml-4.4.2.jar \
--add-opens java.base/java.security=ALL-UNNAMED \
--add-opens java.base/java.net=ALL-UNNAMED \
--add-opens java.base/java.lang=ALL-UNNAMED \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ if "%KARAF_PROFILER%" == "" goto :RUN
"%JAVA%" %JAVA_OPTS% %OPTS% ^
--add-reads=java.xml=java.logging ^
--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED ^
--patch-module java.base=%KARAF_HOME%\lib\endorsed\org.apache.karaf.specs.locator-4.3.9.jar ^
--patch-module java.xml=%KARAF_HOME%\lib\endorsed\org.apache.karaf.specs.java.xml-4.3.9.jar ^
--patch-module java.base=%KARAF_HOME%\lib\endorsed\org.apache.karaf.specs.locator-4.4.2.jar ^
--patch-module java.xml=%KARAF_HOME%\lib\endorsed\org.apache.karaf.specs.java.xml-4.4.2.jar ^
--add-opens java.base/java.security=ALL-UNNAMED ^
--add-opens java.base/java.net=ALL-UNNAMED ^
--add-opens java.base/java.lang=ALL-UNNAMED ^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ karaf.framework=felix
#
# Location of the OSGi frameworks
#
karaf.framework.equinox=mvn\:org.eclipse.platform/org.eclipse.osgi/3.16.300
karaf.framework.felix=mvn\:org.apache.felix/org.apache.felix.framework/6.0.5
karaf.framework.equinox=mvn\:org.eclipse.platform/org.eclipse.osgi/3.18.0
karaf.framework.felix=mvn\:org.apache.felix/org.apache.felix.framework/7.0.5

#
# Framework config properties.
Expand All @@ -41,8 +41,8 @@ org.osgi.framework.system.packages= \
org.osgi.dto;version="1.1",\
org.osgi.resource;version="1.0",\
org.osgi.resource.dto;version="1.0";uses:="org.osgi.dto",\
org.osgi.framework;version="1.9",\
org.osgi.framework.dto;version="1.9";uses:="org.osgi.dto",\
org.osgi.framework;version="1.10",\
org.osgi.framework.dto;version="1.10";uses:="org.osgi.dto",\
org.osgi.framework.hooks.bundle;version="1.1";uses:="org.osgi.framework",\
org.osgi.framework.hooks.resolver;version="1.0";uses:="org.osgi.framework.wiring",\
org.osgi.framework.hooks.service;version="1.1";uses:="org.osgi.framework",\
Expand All @@ -59,12 +59,12 @@ org.osgi.framework.system.packages= \
org.osgi.service.startlevel;version="1.1";uses:="org.osgi.framework",\
org.osgi.service.url;version="1.0",\
org.osgi.util.tracker;version="1.5.2";uses:="org.osgi.framework",\
org.apache.karaf.version;version="4.3.9",\
org.apache.karaf.diagnostic.core;uses:=org.osgi.framework;version="4.3.9",\
org.apache.karaf.diagnostic.core.common;uses:=org.apache.karaf.diagnostic.core;version="4.3.9",\
org.apache.karaf.jaas.boot.principal;uses:=javax.security.auth;version="4.3.9",\
org.apache.karaf.jaas.boot;uses:="javax.security.auth,javax.security.auth.callback,javax.security.auth.login,javax.security.auth.spi,org.osgi.framework";version="4.3.9",\
org.apache.karaf.info;version="4.3.9",\
org.apache.karaf.version;version="4.4.2",\
org.apache.karaf.diagnostic.core;uses:=org.osgi.framework;version="4.4.2",\
org.apache.karaf.diagnostic.core.common;uses:=org.apache.karaf.diagnostic.core;version="4.4.2",\
org.apache.karaf.jaas.boot.principal;uses:=javax.security.auth;version="4.4.2",\
org.apache.karaf.jaas.boot;uses:="javax.security.auth,javax.security.auth.callback,javax.security.auth.login,javax.security.auth.spi,org.osgi.framework";version="4.4.2",\
org.apache.karaf.info;version="4.4.2",\
${jre-${java.specification.version}}

#
Expand Down Expand Up @@ -152,6 +152,18 @@ equinox-capabilities= \
osgi.service;objectClass:List<String>=org.eclipse.osgi.service.security.TrustEngine;osgi.signedcontent.trust.engine=org.eclipse.osgi, \
osgi.service;objectClass:List<String>=org.eclipse.osgi.service.urlconversion.URLConverter;protocol:List<String>="bundleentry,bundleresource"

eecap-18 = osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0,1.1,1.2", \
osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,9.0,10.0,11.0,13.0,14.0,15.0,16.0,17.0,18.0", \
osgi.ee; osgi.ee="JRE"; version:List<Version>="1.0,1.1", \
osgi.ee; osgi.ee="JavaSE/compact1"; version:List<Version>="1.8,9.0,10.0,11.0,13.0,14.0,15.0,16.0,17.0,18.0", \
osgi.ee; osgi.ee="JavaSE/compact2"; version:List<Version>="1.8,9.0,10.0,11.0,13.0,14.0,15.0,16.0,17.0,18.0", \
osgi.ee; osgi.ee="JavaSE/compact3"; version:List<Version>="1.8,9.0,10.0,11.0,13.0,14.0,15.0,16.0,17.0,18.0"
eecap-17 = osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0,1.1,1.2", \
osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,9.0,10.0,11.0,13.0,14.0,15.0,16.0,17.0", \
osgi.ee; osgi.ee="JRE"; version:List<Version>="1.0,1.1", \
osgi.ee; osgi.ee="JavaSE/compact1"; version:List<Version>="1.8,9.0,10.0,11.0,13.0,14.0,15.0,16.0,17.0", \
osgi.ee; osgi.ee="JavaSE/compact2"; version:List<Version>="1.8,9.0,10.0,11.0,13.0,14.0,15.0,16.0,17.0", \
osgi.ee; osgi.ee="JavaSE/compact3"; version:List<Version>="1.8,9.0,10.0,11.0,13.0,14.0,15.0,16.0,17.0"
eecap-16 = osgi.ee; osgi.ee="OSGi/Minimum"; version:List<Version>="1.0,1.1,1.2", \
osgi.ee; osgi.ee="JavaSE"; version:List<Version>="1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,9.0,10.0,11.0,13.0,14.0,15.0,16.0", \
osgi.ee; osgi.ee="JRE"; version:List<Version>="1.0,1.1", \
Expand Down
2 changes: 1 addition & 1 deletion buildsupport/groovy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-dateutil</artifactId>
<version>${groovy.version}</version>
<version>3.0.19</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion buildsupport/logging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<properties>
<slf4j.version>1.7.36</slf4j.version>
<logback.version>1.2.13</logback.version>
<pax-logging.version>2.0.18</pax-logging.version>
<pax-logging.version>2.1.3</pax-logging.version>
</properties>

<dependencyManagement>
Expand Down
8 changes: 4 additions & 4 deletions buildsupport/osgi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<packaging>pom</packaging>

<properties>
<spifly.version>1.3.6</spifly.version>
<spifly.version>1.3.7</spifly.version>
</properties>

<dependencyManagement>
Expand All @@ -48,7 +48,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>6.0.5</version>
<version>7.0.5</version>
</dependency>

<dependency>
Expand All @@ -66,7 +66,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
<version>2.1.20</version>
<version>2.2.4</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -185,7 +185,7 @@
<dependency>
<groupId>org.apache.aries.spifly</groupId>
<artifactId>org.apache.aries.spifly.dynamic.bundle</artifactId>
<version>1.2.1</version>
<version>${spifly.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
13 changes: 1 addition & 12 deletions changed.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,15 @@
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/

@Grab(group = 'ch.qos.logback', module = 'logback-classic', version = '1.2.3')
@Grab(group = 'org.apache.maven', module = 'maven-model', version = '3.5.0')
@Grab(group = 'org.apache.maven', module = 'maven-model', version = '3.8.1')
@Grab(group = 'org.ajoberstar', module = 'grgit', version = '2.2.1')

import ch.qos.logback.classic.Logger

import org.ajoberstar.grgit.*
import org.ajoberstar.grgit.operation.*
import org.ajoberstar.grgit.service.*
import org.apache.maven.model.Model
import org.apache.maven.model.io.xpp3.MavenXpp3Reader

import static ch.qos.logback.classic.Level.*

import static org.slf4j.Logger.ROOT_LOGGER_NAME
import static org.slf4j.LoggerFactory.getLogger

// set default log level (jgit seems to have something on DEBUG by default)
((Logger) getLogger(ROOT_LOGGER_NAME)).setLevel(OFF)

def getChangedProjects() {
def grgit = Grgit.open()
def changes = grgit.status().staged.getAllChanges() + grgit.status().unstaged.getAllChanges()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import org.sonatype.nexus.bootstrap.internal.DirectoryHelper;

import org.osgi.framework.Version;

import com.google.common.annotations.VisibleForTesting;

import static java.lang.Boolean.parseBoolean;
Expand All @@ -35,6 +37,8 @@ public class NexusEditionPropertiesConfigurer

private static final String NEXUS_EXCLUDE_FEATURES = "nexus-exclude-features";

private static final Version ORIENT_MAX_JAVA_VERSION = new Version(11, 0, 0);

public Properties getPropertiesFromConfiguration() throws IOException {

Properties properties = System.getProperties();
Expand Down Expand Up @@ -131,11 +135,22 @@ private void selectDbFeature(final Properties properties) {
properties.setProperty("nexus.quartz.jobstore.jdbc", "true");
}
else {
ensureOrientRunningWithCorrectJavaRuntime();
properties.setProperty(NEXUS_DB_FEATURE, "nexus-orient");
properties.setProperty(ORIENT_ENABLED, "true");
}
}

@VisibleForTesting
void ensureOrientRunningWithCorrectJavaRuntime() {
Version currentVersion = new Version(System.getProperty("java.version").replace("_", "."));
boolean versionAllowed = currentVersion.getMajor() <= ORIENT_MAX_JAVA_VERSION.getMajor();
if (!versionAllowed) {
throw new IllegalStateException("The maximum Java version for OrientDb is Java 11. " +
"Please check current Java version meets this requirement.");
}
}

private void selectAuthenticationFeature(final Properties properties) {
if (parseBoolean(properties.getProperty(SESSION_ENABLED, "true"))) {
properties.setProperty(SESSION_ENABLED, "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,19 @@ public void testDoNotThrowExceptionIfHACIsDisabledInEnvVariables() {
underTest.ensureHACIsDisabled();
}

@Test(expected = Test.None.class)
public void testOrientDbWithAllowedVersion() {
System.setProperty("java.version", "11.0.0");
underTest.ensureOrientRunningWithCorrectJavaRuntime();
}

@Test
public void testOrientDbWithNotAllowedVersion() {
System.setProperty("java.version", "17.0.0");
IllegalStateException expected = assertThrows(IllegalStateException.class,
underTest::ensureOrientRunningWithCorrectJavaRuntime
);
assertThat(expected.getMessage(), containsString("The maximum Java version for OrientDb is Java 11"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,6 @@ public interface FeatureFlags
* See https://owasp.org/www-community/controls/SecureCookieAttribute
*/
String NXSESSIONID_SECURE_COOKIE_NAMED = "${nexus.session.secureCookie:-true}";

String API_EXTENDED = "nexus.api.extended.enabled";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Sonatype Nexus (TM) Open Source Version
* Copyright (c) 2008-present Sonatype, Inc.
* All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
*
* This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
* which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
*
* Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.nexus.internal.script.groovy;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.script.ScriptEngineManager;

import org.sonatype.nexus.common.app.ApplicationDirectories;
import org.sonatype.nexus.common.app.ManagedLifecycle;
import org.sonatype.nexus.common.stateguard.StateGuardLifecycleSupport;

import static com.google.common.base.Preconditions.checkNotNull;
import static org.sonatype.nexus.common.app.ManagedLifecycle.Phase.SERVICES;

/**
* Groovy script engine loader. Is used to run groovy scripts.
*/
@Named
@Singleton
@ManagedLifecycle(phase = SERVICES)
public class GroovyScriptEngineLoader
extends StateGuardLifecycleSupport
{
private final ClassLoader classLoader;

private final ApplicationDirectories applicationDirectories;

private final ScriptEngineManager scriptEngineManager;

@Inject
public GroovyScriptEngineLoader(
final @Named("nexus-uber") ClassLoader classLoader,
final ApplicationDirectories applicationDirectories,
final ScriptEngineManager scriptEngineManager)
{
this.classLoader = checkNotNull(classLoader);
this.applicationDirectories = checkNotNull(applicationDirectories);
this.scriptEngineManager = checkNotNull(scriptEngineManager);
}

@Override
protected void doStart() throws Exception {
GroovyScriptEngineFactory groovyEngineFactory = new GroovyScriptEngineFactory(classLoader, applicationDirectories);
log.debug("Registering engine-factory: {}", groovyEngineFactory);
groovyEngineFactory.getNames().forEach(name -> scriptEngineManager.registerEngineName(name, groovyEngineFactory));
}
}
22 changes: 0 additions & 22 deletions components/nexus-orient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -192,26 +192,4 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>test-on-java17</id>
<activation>
<jdk>[17,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
--add-exports java.base/sun.nio.ch=ALL-UNNAMED
</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Loading

0 comments on commit 18d4727

Please sign in to comment.