From 0e25cf118d88428769f36c98c7a5b624d627ac94 Mon Sep 17 00:00:00 2001
From: vharseko <vharseko@3a-systems.ru>
Date: Wed, 18 May 2022 15:55:29 +0000
Subject: [PATCH] Add support jdk '16','17','18' (#232)

---
 opendj-dsml-servlet/pom.xml                                                         |   30 ++++++++-------
 opendj-dsml-servlet/resources/schema/bindings.xjb                                   |    2 
 opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLSearchOperation.java |    2 
 .github/workflows/deploy.yml                                                        |    4 +-
 .github/workflows/release.yml                                                       |    2 
 .github/workflows/build.yml                                                         |    5 +-
 opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLServlet.java         |   10 ++--
 pom.xml                                                                             |   15 +++++--
 8 files changed, 39 insertions(+), 31 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d48103e..8c4353c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -2,7 +2,6 @@
 
 on:
   push:
-    branches: [ master ]
   pull_request:
     branches: [ master ]
 
@@ -11,7 +10,7 @@
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-        java: [ '8', '11']
+        java: [ '8','11','16','17','18']
         os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
     steps:
     - name:  Install wine+rpm for distribution
@@ -33,7 +32,7 @@
       uses: actions/setup-java@v2
       with:
         java-version: ${{ matrix.java }}
-        distribution: 'adopt'
+        distribution: 'temurin'
     - name: Cache Maven packages
       uses: actions/cache@v3
       with:
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 3f5669b..a97718d 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -6,7 +6,7 @@
     workflows: ["Build"]
     types: [completed]
 jobs:
-  deploy-maven:
+  package-deploy-maven:
     if: ${{ github.event.workflow_run.conclusion == 'success' }}
     runs-on: 'ubuntu-latest'
     steps:
@@ -33,7 +33,7 @@
         uses: actions/setup-java@v2
         with:
           java-version: '8'
-          distribution: 'adopt'
+          distribution: 'temurin'
           server-id: ossrh
           server-username: MAVEN_USERNAME
           server-password: MAVEN_PASSWORD
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 0c3d434..02387c5 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -37,7 +37,7 @@
         uses: actions/setup-java@v2
         with:
           java-version: '8'
-          distribution: 'adopt'
+          distribution: 'temurin'
           server-id: ossrh
           server-username: MAVEN_USERNAME
           server-password: MAVEN_PASSWORD
diff --git a/opendj-dsml-servlet/pom.xml b/opendj-dsml-servlet/pom.xml
index 6129d71..ccb92e3 100644
--- a/opendj-dsml-servlet/pom.xml
+++ b/opendj-dsml-servlet/pom.xml
@@ -86,6 +86,12 @@
 		    <version>2.3.2</version>
 		    <type>pom</type>
         </dependency>
+        
+        <dependency>
+		    <groupId>jakarta.xml.bind</groupId>
+		    <artifactId>jakarta.xml.bind-api</artifactId>
+		    <version>3.0.1</version>
+		</dependency>
     </dependencies>
 
     <build><finalName>${project.groupId}.${project.artifactId}</finalName>
@@ -229,7 +235,7 @@
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>jaxb2-maven-plugin</artifactId>
-                <version>1.6</version>
+                <version>3.1.0</version>
                 <executions>
                     <execution>
                         <id>prepare-dsml-library</id>
@@ -238,23 +244,19 @@
                         </goals>
                         <configuration>
                             <outputDirectory>${project.build.directory}/gen</outputDirectory>
-                            <schemaDirectory>${basedir}/resources/schema</schemaDirectory>
-                            <schemaFiles>DSMLv2.xsd</schemaFiles>
+                            <sources>
+                            	<source>resources/schema/DSMLv2.xsd</source>
+                            </sources>
                             <packageName>org.opends.dsml.protocol</packageName>
-                            <bindingDirectory>${basedir}/resources/schema</bindingDirectory>
-                            <bindingFiles>bindings.xjb</bindingFiles>
-                            <target>2.1</target>
-                            <npa>true</npa>
+                            <xjbSources>
+                            	<xjbSource>resources/schema/bindings.xjb</xjbSource>
+                            </xjbSources>
+                            <target>3.0</target>
+                            <extension>true</extension>
+                            <noPackageLevelAnnotations>true</noPackageLevelAnnotations>
                         </configuration>
                     </execution>
                 </executions>
-                <dependencies>
-                	<dependency>
-					    <groupId>javax.activation</groupId>
-					    <artifactId>activation</artifactId>
-					    <version>1.1.1</version>
-					</dependency>
-                </dependencies>
             </plugin>
 
             <!-- WAR artefact is build by the assembly plugin -->
diff --git a/opendj-dsml-servlet/resources/schema/bindings.xjb b/opendj-dsml-servlet/resources/schema/bindings.xjb
index 9938420..0847ba4 100644
--- a/opendj-dsml-servlet/resources/schema/bindings.xjb
+++ b/opendj-dsml-servlet/resources/schema/bindings.xjb
@@ -14,7 +14,7 @@
 
   Copyright 2012 ForgeRock AS.
   ! -->
-<bindings xmlns="http://java.sun.com/xml/ns/jaxb" version="2.0" 
+<bindings xmlns="https://jakarta.ee/xml/ns/jaxb" version="3.0" 
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" schemaLocation="DSMLv2.xsd" >
  <bindings 
 node="//xsd:complexType[@name='AttributeValueAssertion']/xsd:sequence/xsd:element[@name='value']">
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLSearchOperation.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLSearchOperation.java
index f922177..4df2a4c 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLSearchOperation.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLSearchOperation.java
@@ -24,7 +24,7 @@
 import java.util.LinkedList;
 import java.util.List;
 
-import javax.xml.bind.JAXBElement;
+import jakarta.xml.bind.JAXBElement;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.ByteString;
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 f015796..ac7802b 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
@@ -50,11 +50,11 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.xml.XMLConstants;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
+import jakarta.xml.bind.JAXBContext;
+import jakarta.xml.bind.JAXBElement;
+import jakarta.xml.bind.JAXBException;
+import jakarta.xml.bind.Marshaller;
+import jakarta.xml.bind.Unmarshaller;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
diff --git a/pom.xml b/pom.xml
index 7dcc2a7..b0faf50 100644
--- a/pom.xml
+++ b/pom.xml
@@ -356,7 +356,7 @@
                     <inherited>true</inherited>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-compiler-plugin</artifactId>
-                    <version>3.8.1</version>
+                    <version>3.10.1</version>
                     <configuration>
                         <fork>true</fork>
                         <compilerArgs>
@@ -440,9 +440,8 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-surefire-plugin</artifactId>
-                    <version>3.0.0-M4</version>
+                    <version>3.0.0-M4</version> <!-- M6 DecodeException but got java.nio.BufferOverflowException -->
                     <configuration>
-                        <argLine>-server</argLine>
                         <properties>
                             <property>
                                 <name>usedefaultlisteners</name>
@@ -705,7 +704,15 @@
                 <module>opendj-packages</module>
             </modules>
         </profile>
-
+		<profile>		
+	      <id>jdk16.options</id>
+	      <activation>
+	        <jdk>[16,)</jdk>
+	      </activation>
+	      <properties>
+	        <argLine>--add-exports java.base/sun.security.x509=ALL-UNNAMED --add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED  --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util.regex=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED</argLine>
+	      </properties>
+	    </profile>
 		<profile>
 	        <id>release-sign-artifacts</id>
 	        <activation>

--
Gitblit v1.10.0