From 52c9114d486fa9f38a8039316144ff6910abed2a Mon Sep 17 00:00:00 2001
From: maximthomas <maxim.thomas@gmail.com>
Date: Wed, 25 Dec 2024 11:09:21 +0000
Subject: [PATCH] Update target JDK to 11 and move to JakartaEE

---
 opendj-rest2ldap-servlet/pom.xml                                                                                           |    2 
 opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java                                                  |    3 
 opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java                                                |    2 
 .github/workflows/deploy.yml                                                                                               |    2 
 opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLServlet.java                                                |   10 +-
 opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Utils.java                                                   |    4 
 pom.xml                                                                                                                    |   21 ++----
 opendj-server/pom.xml                                                                                                      |   12 ++--
 opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java                                              |    2 
 opendj-dsml-servlet/pom.xml                                                                                                |    6 +-
 opendj-server-legacy/pom.xml                                                                                               |    2 
 opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java                                                |   22 +++---
 .github/workflows/release.yml                                                                                              |    2 
 .github/workflows/build.yml                                                                                                |    2 
 opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java                                               |    2 
 opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/api/AbortedChangelogCursorException.java |    2 
 opendj-core/src/main/java/org/forgerock/opendj/ldap/Base64.java                                                            |    2 
 opendj-core/pom.xml                                                                                                        |   27 ++-------
 18 files changed, 52 insertions(+), 73 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c88f414..a0fa2a8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -10,7 +10,7 @@
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-        java: [ '8','11','17','21','23']
+        java: [ '11','17','21','23']
         os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
       fail-fast: false
     steps:
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 6abb4e4..dbd46d0 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -33,7 +33,7 @@
       - name: Set up Java for publishing to Maven Central Repository OSS
         uses: actions/setup-java@v4
         with:
-          java-version: '8'
+          java-version: '11'
           distribution: 'temurin'
           server-id: ossrh
           server-username: MAVEN_USERNAME
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 034e8ae..7ca4607 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -37,7 +37,7 @@
       - name: Set up Java for publishing to Maven Central Repository OSS
         uses: actions/setup-java@v4
         with:
-          java-version: '8'
+          java-version: '11'
           distribution: 'temurin'
           server-id: ossrh
           server-username: MAVEN_USERNAME
diff --git a/opendj-core/pom.xml b/opendj-core/pom.xml
index 2ea42d5..b01d5a1 100644
--- a/opendj-core/pom.xml
+++ b/opendj-core/pom.xml
@@ -79,16 +79,16 @@
         
         <!--         java.xml.bind (JAXB) - REMOVED -->
 	    <dependency>
-		  <groupId>javax.xml.bind</groupId>
-		  <artifactId>jaxb-api</artifactId>
+          <groupId>jakarta.xml.bind</groupId>
+          <artifactId>jakarta.xml.bind-api</artifactId>
 		</dependency>
 		<dependency>
-		  <groupId>com.sun.xml.bind</groupId>
-		  <artifactId>jaxb-core</artifactId>
+          <groupId>org.glassfish.jaxb</groupId>
+          <artifactId>jaxb-core</artifactId>
 		</dependency>
 		<dependency>
-		  <groupId>com.sun.xml.bind</groupId>
-		  <artifactId>jaxb-impl</artifactId>
+          <groupId>org.glassfish.jaxb</groupId>
+          <artifactId>jaxb-runtime</artifactId>
 		</dependency>
 
 	    <!-- BC FIPS Provider libs -->
@@ -216,21 +216,6 @@
 
     <profiles>
         <profile>
-            <id>set-compiler-release</id>
-            <activation>
-                <jdk>[9,)</jdk>
-            </activation>
-            <properties>
-                <maven.compiler.release>8</maven.compiler.release>
-                <!--
-                -release 8 dont allow hidden packages
-                package sun.security.tools.keytool does not exist
-                package sun.security.x509 does not exist
-                -->
-                <maven.compiler.testRelease />
-            </properties>
-        </profile>
-        <profile>
             <!-- This profile provides API/ABI compatiblity checks and reports via Clirr -->
             <id>clirr</id>
             <activation>
diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Base64.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/Base64.java
index aa0b5ee..25b2418 100644
--- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Base64.java
+++ b/opendj-core/src/main/java/org/forgerock/opendj/ldap/Base64.java
@@ -29,7 +29,7 @@
  * sets of three bytes with eight significant bits each to sets of four bytes
  * with six significant bits each.
  * <p>
- * <b>NOTE:</b> the JDK class {@link javax.xml.bind.DatatypeConverter} provides
+ * <b>NOTE:</b> the JDK class {@link jakarta.xml.bind.DatatypeConverter} provides
  * similar functionality, however the methods are better suited to the LDAP SDK.
  * For example, the JDK encoder does not handle array/offset/len parameters, and
  * the decoder ignores invalid Base64 data.
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java
index e761742..27dcb0f 100644
--- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java
@@ -19,7 +19,7 @@
 import java.io.ByteArrayOutputStream;
 import java.util.Arrays;
 
-import javax.xml.bind.DatatypeConverter;
+import jakarta.xml.bind.DatatypeConverter;
 
 import org.testng.Assert;
 import org.testng.annotations.Test;
diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java
index 8c75e09..b4c754f 100644
--- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java
+++ b/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java
@@ -22,7 +22,7 @@
 import java.nio.charset.CharsetDecoder;
 import java.util.Arrays;
 
-import javax.xml.bind.DatatypeConverter;
+import jakarta.xml.bind.DatatypeConverter;
 
 import org.forgerock.i18n.LocalizedIllegalArgumentException;
 import org.testng.Assert;
diff --git a/opendj-dsml-servlet/pom.xml b/opendj-dsml-servlet/pom.xml
index 14eee10..7b19d70 100644
--- a/opendj-dsml-servlet/pom.xml
+++ b/opendj-dsml-servlet/pom.xml
@@ -39,9 +39,9 @@
     <dependencies>
     	<!-- Servlet API -->
         <dependency>
-      		<groupId>javax.servlet</groupId>
-      		<artifactId>javax.servlet-api</artifactId>
-      		<version>3.1.0</version>
+      		<groupId>jakarta.servlet</groupId>
+      		<artifactId>jakarta.servlet-api</artifactId>
+      		<version>6.0.0</version>
             <scope>provided</scope>
     	</dependency>
 
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLServlet.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLServlet.java
index ac7802b..0001971 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLServlet.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLServlet.java
@@ -44,11 +44,11 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.ServletConfig;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServlet;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
 import javax.xml.XMLConstants;
 import jakarta.xml.bind.JAXBContext;
 import jakarta.xml.bind.JAXBElement;
diff --git a/opendj-rest2ldap-servlet/pom.xml b/opendj-rest2ldap-servlet/pom.xml
index 0200445..78b188d 100644
--- a/opendj-rest2ldap-servlet/pom.xml
+++ b/opendj-rest2ldap-servlet/pom.xml
@@ -121,7 +121,7 @@
 			</executions>
             <configuration>
                 <container>
-                    <containerId>tomcat9x</containerId>
+                    <containerId>tomcat10x</containerId>
                     <type>embedded</type>
                     <systemProperties>
                         <file.encoding>UTF-8</file.encoding>
diff --git a/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Utils.java b/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Utils.java
index dc52087..c02cf4a 100644
--- a/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Utils.java
+++ b/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Utils.java
@@ -15,8 +15,8 @@
  */
 package org.forgerock.opendj.rest2ldap;
 
-import static javax.xml.bind.DatatypeConverter.parseDateTime;
-import static javax.xml.bind.DatatypeConverter.printDateTime;
+import static jakarta.xml.bind.DatatypeConverter.parseDateTime;
+import static jakarta.xml.bind.DatatypeConverter.printDateTime;
 import static org.forgerock.opendj.ldap.Filter.alwaysFalse;
 import static org.forgerock.opendj.ldap.Functions.byteStringToBoolean;
 import static org.forgerock.opendj.ldap.Functions.byteStringToGeneralizedTime;
diff --git a/opendj-server-legacy/pom.xml b/opendj-server-legacy/pom.xml
index 97008f7..b2cb440 100644
--- a/opendj-server-legacy/pom.xml
+++ b/opendj-server-legacy/pom.xml
@@ -208,7 +208,7 @@
     <!-- mail -->
     <dependency>
       <groupId>com.sun.mail</groupId>
-      <artifactId>javax.mail</artifactId>
+      <artifactId>jakarta.mail</artifactId>
     </dependency>
 
     <dependency>
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
index 607bc47..22ca0da 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
@@ -27,7 +27,7 @@
 import java.util.TimeZone;
 import java.util.UUID;
 
-import javax.mail.MessagingException;
+import jakarta.mail.MessagingException;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageDescriptor.Arg2;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java b/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
index b452231..4561a94 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
@@ -43,7 +43,7 @@
 import java.util.Map.Entry;
 import java.util.concurrent.CopyOnWriteArrayList;
 
-import static javax.xml.bind.DatatypeConverter.printDateTime;
+import static jakarta.xml.bind.DatatypeConverter.printDateTime;
 import static org.forgerock.opendj.ldap.Functions.*;
 import static org.opends.messages.ConfigMessages.*;
 import static org.opends.server.protocols.internal.Requests.newSearchRequest;
@@ -51,7 +51,6 @@
 import static org.opends.server.util.ServerConstants.MBEAN_BASE_DOMAIN;
 import static org.opends.server.util.StaticUtils.isAlpha;
 import static org.opends.server.util.StaticUtils.isDigit;
-import static org.opends.server.schema.SchemaConstants.SYNTAX_INTEGER_OID;
 
 /**
  * This class defines a JMX MBean that can be registered with the Directory
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/api/AbortedChangelogCursorException.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/api/AbortedChangelogCursorException.java
index 48f2937..26d4e0a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/api/AbortedChangelogCursorException.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/api/AbortedChangelogCursorException.java
@@ -15,7 +15,7 @@
  */
 package org.opends.server.replication.server.changelog.api;
 
-import javax.annotation.Generated;
+import jakarta.annotation.Generated;
 
 import org.forgerock.i18n.LocalizableMessage;
 
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java b/opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java
index 560705c..99121e1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/EMailMessage.java
@@ -35,16 +35,16 @@
 import java.util.List;
 import java.util.Properties;
 
-import javax.activation.DataHandler;
-import javax.activation.FileDataSource;
-import javax.mail.MessagingException;
-import javax.mail.SendFailedException;
-import javax.mail.Session;
-import javax.mail.Transport;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
+import jakarta.activation.DataHandler;
+import jakarta.activation.FileDataSource;
+import jakarta.mail.MessagingException;
+import jakarta.mail.SendFailedException;
+import jakarta.mail.Session;
+import jakarta.mail.Transport;
+import jakarta.mail.internet.InternetAddress;
+import jakarta.mail.internet.MimeBodyPart;
+import jakarta.mail.internet.MimeMessage;
+import jakarta.mail.internet.MimeMultipart;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
@@ -410,7 +410,7 @@
         }
       }
       message.setRecipients(
-              javax.mail.Message.RecipientType.TO,
+              jakarta.mail.Message.RecipientType.TO,
               recipientAddresses);
 
 
diff --git a/opendj-server/pom.xml b/opendj-server/pom.xml
index a21b164..e59d936 100644
--- a/opendj-server/pom.xml
+++ b/opendj-server/pom.xml
@@ -74,14 +74,14 @@
       <artifactId>opendj-cli</artifactId>
     </dependency>
     <dependency>
-    	<groupId>javax.annotation</groupId>
-    	<artifactId>javax.annotation-api</artifactId>
-    	<version>1.3.2</version>
+      <groupId>jakarta.annotation</groupId>
+      <artifactId>jakarta.annotation-api</artifactId>
+      <version>3.0.0</version>
     </dependency>
     <dependency>
-      <groupId>com.sun.activation</groupId>
-      <artifactId>javax.activation</artifactId>
-      <version>1.2.0</version>
+      <groupId>jakarta.activation</groupId>
+      <artifactId>jakarta.activation-api</artifactId>
+      <version>2.1.3</version>
     </dependency>
   </dependencies>
   <build><finalName>${project.groupId}.${project.artifactId}</finalName>
diff --git a/pom.xml b/pom.xml
index a7b14ef..d3d49fe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,12 +35,12 @@
         <product.locales>ca_ES,es,de,fr,ja,ko,pl,zh_CN,zh_TW</product.locales>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <localized.jars.classifier>i18n</localized.jars.classifier>
-        <commons.version>2.2.3</commons.version>
+        <commons.version>2.2.4-SNAPSHOT</commons.version>
         <freemarker.version>2.3.31</freemarker.version>
         <grizzly-framework.version>2.3.35</grizzly-framework.version>
         <metrics-core.version>3.1.2</metrics-core.version>
-        <maven.compiler.target>8</maven.compiler.target>
-        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>11</maven.compiler.target>
+        <maven.compiler.source>11</maven.compiler.source>
         <!-- OSGi bundles properties -->
         <opendj.osgi.import.additional />
         <!--
@@ -368,6 +368,10 @@
                         <fork>true</fork>
                         <compilerArgs>
                         	<arg>-XDignore.symbol.file</arg>
+                            <arg>--add-exports</arg>
+                            <arg>java.base/sun.security.x509=ALL-UNNAMED</arg>
+                            <arg>--add-exports</arg>
+                            <arg>java.base/sun.security.tools.keytool=ALL-UNNAMED</arg>
                         </compilerArgs>
                     </configuration>
                 </plugin>
@@ -475,7 +479,7 @@
                 <plugin>
                     <groupId>org.apache.felix</groupId>
                     <artifactId>maven-bundle-plugin</artifactId>
-                    <version>2.3.7</version>
+                    <version>5.1.9</version>
                     <extensions>true</extensions>
                     <configuration>
                         <instructions>
@@ -717,15 +721,6 @@
             </modules>
         </profile>
         <profile>
-            <id>set-compiler-release</id>
-            <activation>
-                <jdk>[9,)</jdk>
-            </activation>
-            <properties>
-                <maven.compiler.release>8</maven.compiler.release>
-            </properties>
-        </profile>
-		<profile>
 	      <id>jdk16.options</id>
 	      <activation>
 	        <jdk>[16,)</jdk>

--
Gitblit v1.10.0