mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-3347 Upgrade to Java 17 (#1253)
* Addressing JDK-8189366, JDK-8212114, JDK-8208487, changes to default legacy Locale ISO Code conversions and changes to JVM arguments to allow illegal reflective access
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
dist: focal
|
||||
language: java
|
||||
jdk: openjdk11
|
||||
jdk: openjdk17
|
||||
|
||||
services:
|
||||
- docker
|
||||
|
@@ -30,16 +30,20 @@
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Keeping illegal-access=permit for Java 11 compatibility, even though it has no effect on JDK 17 -->
|
||||
<argLine>
|
||||
--illegal-access=permit
|
||||
--add-opens=java.base/java.lang=ALL-UNNAMED
|
||||
</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<!-- Keeping illegal-access=permit for Java 11 compatibility, even though it has no effect on JDK 17 -->
|
||||
<configuration>
|
||||
<argLine>
|
||||
--illegal-access=permit
|
||||
--add-opens=java.base/java.lang=ALL-UNNAMED
|
||||
</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Fetch image based on Tomcat 9.0, Java 11 and Centos 7
|
||||
# Fetch image based on Tomcat 9.0, Java 17 and Rocky Linux 8
|
||||
# More infos about this image: https://github.com/Alfresco/alfresco-docker-base-tomcat
|
||||
FROM alfresco/alfresco-base-tomcat:tomcat9-jre11-rockylinux8-202205140719
|
||||
FROM alfresco/alfresco-base-tomcat:tomcat9-jre17-rockylinux8-202205140719
|
||||
|
||||
# Set default docker_context.
|
||||
ARG resource_path=target
|
||||
|
@@ -106,8 +106,10 @@
|
||||
<suiteXmlFiles>
|
||||
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
|
||||
</suiteXmlFiles>
|
||||
<!-- Keeping illegal-access=warn for Java 11 compatibility, even though it has no effect on JDK 17 -->
|
||||
<argLine>
|
||||
--illegal-access=warn
|
||||
--add-opens=java.base/java.lang=ALL-UNNAMED
|
||||
</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@@ -78,8 +78,10 @@
|
||||
<suiteXmlFiles>
|
||||
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
|
||||
</suiteXmlFiles>
|
||||
<!-- Keeping illegal-access=warn for Java 11 compatibility, even though it has no effect on JDK 17 -->
|
||||
<argLine>
|
||||
--illegal-access=warn
|
||||
--add-opens=java.base/java.lang=ALL-UNNAMED
|
||||
</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
@@ -25,44 +25,39 @@
|
||||
*/
|
||||
package org.alfresco.repo.content.transform;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.junit.MockitoJUnit;
|
||||
import org.mockito.junit.MockitoRule;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import static org.alfresco.repo.content.transform.LocalTransformServiceRegistry.LOCAL_TRANSFORMER;
|
||||
import static org.alfresco.repo.content.transform.LocalTransformServiceRegistry.URL;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class LocalTransformServiceRegistryTest
|
||||
{
|
||||
@Spy
|
||||
private Properties properties = new Properties();
|
||||
|
||||
private Properties properties;
|
||||
@InjectMocks
|
||||
LocalTransformServiceRegistry registry = new LocalTransformServiceRegistry();
|
||||
|
||||
@Rule
|
||||
public MockitoRule initRule = MockitoJUnit.rule();
|
||||
private LocalTransformServiceRegistry registry;
|
||||
|
||||
@Test
|
||||
public void testGetTEngineUrlsSortedByName() throws IOException
|
||||
public void testGetTEngineUrlsSortedByName()
|
||||
{
|
||||
properties.put(LOCAL_TRANSFORMER+"aa"+URL, "aa");
|
||||
properties.put(LOCAL_TRANSFORMER+"engine1"+URL, "http_xxxx1");
|
||||
properties.put(LOCAL_TRANSFORMER+"engine3"+URL, "http3");
|
||||
properties.put(LOCAL_TRANSFORMER+"engine2"+URL, "http_xx2");
|
||||
properties.put(LOCAL_TRANSFORMER+"bb"+URL, "bb");
|
||||
properties.put(LOCAL_TRANSFORMER+"b"+URL, "b");
|
||||
properties.put(LOCAL_TRANSFORMER + "aa" + URL, "aa");
|
||||
properties.put(LOCAL_TRANSFORMER + "engine1" + URL, "http_xxxx1");
|
||||
properties.put(LOCAL_TRANSFORMER + "engine3" + URL, "http3");
|
||||
properties.put(LOCAL_TRANSFORMER + "engine2" + URL, "http_xx2");
|
||||
properties.put(LOCAL_TRANSFORMER + "bb" + URL, "bb");
|
||||
properties.put(LOCAL_TRANSFORMER + "b" + URL, "b");
|
||||
|
||||
StringJoiner orderEngineConfigRead = new StringJoiner(",");
|
||||
registry.getTEngineUrlsSortedByName().forEach(name -> orderEngineConfigRead.add(name));
|
||||
registry.getTEngineUrlsSortedByName().forEach(orderEngineConfigRead::add);
|
||||
assertEquals("aa,b,bb,http_xxxx1,http_xx2,http3", orderEngineConfigRead.toString());
|
||||
}
|
||||
}
|
||||
|
@@ -455,7 +455,7 @@ public class ImapMessageTest extends TestCase
|
||||
};
|
||||
// UID SEARCH SINCE
|
||||
Response[] ret = (Response[]) folder.doCommand(uid_search_since);
|
||||
assertEquals("java.net.SocketException: Connection reset", ret[0].getException().toString());
|
||||
assertEquals("java.io.IOException: Connection dropped by server?", ret[0].getException().toString());
|
||||
}
|
||||
catch (MessagingException e)
|
||||
{
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.repo.model.ml.tools;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -45,7 +45,7 @@ import org.junit.experimental.categories.Category;
|
||||
public class ContentFilterLanguagesMapTest extends AbstractMultilingualTestCases
|
||||
{
|
||||
|
||||
public void testGetFilterLanguages() throws Exception
|
||||
public void testGetFilterLanguages()
|
||||
{
|
||||
// get the list of content filter languages
|
||||
List<String> lggs = contentFilterLanguagesService.getFilterLanguages();
|
||||
@@ -57,7 +57,7 @@ public class ContentFilterLanguagesMapTest extends AbstractMultilingualTestCases
|
||||
try
|
||||
{
|
||||
lggs.add("NEW LOCALE");
|
||||
assertTrue("Add a value to the content filter language list is not permit, this list would be read only", false);
|
||||
fail("Add a value to the content filter language list is not permit, this list would be read only");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -67,7 +67,7 @@ public class ContentFilterLanguagesMapTest extends AbstractMultilingualTestCases
|
||||
try
|
||||
{
|
||||
lggs.remove(0);
|
||||
assertTrue("Remove a value to the content filter language list is not permit, this list would be read only", false);
|
||||
fail("Remove a value to the content filter language list is not permit, this list would be read only");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -76,7 +76,7 @@ public class ContentFilterLanguagesMapTest extends AbstractMultilingualTestCases
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testGetMissingLanguages() throws Exception
|
||||
public void testGetMissingLanguages()
|
||||
{
|
||||
List<String> lggs = contentFilterLanguagesService.getFilterLanguages();
|
||||
|
||||
@@ -97,7 +97,7 @@ public class ContentFilterLanguagesMapTest extends AbstractMultilingualTestCases
|
||||
assertEquals("Language list returned with the empty parameter corrupted", missingLggsEmpty.size(), lggs.size());
|
||||
|
||||
// get missing languages with a two locale list
|
||||
List<String> param = new ArrayList<String>();
|
||||
List<String> param = new ArrayList<>();
|
||||
param.add(0, lggs.get(0));
|
||||
param.add(1, lggs.get(1));
|
||||
List<String> missingLggsOk = contentFilterLanguagesService.getMissingLanguages(param);
|
||||
@@ -123,29 +123,29 @@ public class ContentFilterLanguagesMapTest extends AbstractMultilingualTestCases
|
||||
assertFalse("Language found : " + param.get(2), missingLggsWrong.contains(param.get(2)));
|
||||
}
|
||||
|
||||
public void testISOCodeConvertions() throws Exception
|
||||
public void testISOCodeConversions()
|
||||
{
|
||||
// New ISO code list
|
||||
String[] newCode = {"he", "id", "yi"};
|
||||
String[] oldCode = {"iw", "in", "ji"};
|
||||
|
||||
Locale loc0 = new Locale(newCode[0]);
|
||||
Locale loc1 = new Locale(newCode[1]);
|
||||
Locale loc2 = new Locale(newCode[2]);
|
||||
Locale loc0 = new Locale(oldCode[0]);
|
||||
Locale loc1 = new Locale(oldCode[1]);
|
||||
Locale loc2 = new Locale(oldCode[2]);
|
||||
|
||||
// Ensure that java.util.Locale has converted the new ISO code into new iso code
|
||||
assertEquals("java.util.Locale Convertion not correct for " + newCode[0], oldCode[0], loc0.getLanguage());
|
||||
assertEquals("java.util.Locale Convertion not correct for " + newCode[1], oldCode[1], loc1.getLanguage());
|
||||
assertEquals("java.util.Locale Convertion not correct for " + newCode[2], oldCode[2], loc2.getLanguage());
|
||||
// Ensure that java.util.Locale has converted the old ISO code into new ISO code
|
||||
// This conversion can be avoided by setting the java.locale.useOldISOCodes=true system property
|
||||
assertEquals("java.util.Locale Conversion not correct for " + oldCode[0], newCode[0], loc0.getLanguage());
|
||||
assertEquals("java.util.Locale Conversion not correct for " + oldCode[1], newCode[1], loc1.getLanguage());
|
||||
assertEquals("java.util.Locale Conversion not correct for " + oldCode[2], newCode[2], loc2.getLanguage());
|
||||
|
||||
// Ensure that the convertion is correcte
|
||||
assertEquals("Convertion of new ISO codes not correct for " + newCode[0], oldCode[0], contentFilterLanguagesService.convertToOldISOCode(newCode[0]));
|
||||
assertEquals("Convertion of new ISO codes not correct for " + newCode[1], oldCode[1], contentFilterLanguagesService.convertToOldISOCode(newCode[1]));
|
||||
assertEquals("Convertion of new ISO codes not correct for " + newCode[2], oldCode[2], contentFilterLanguagesService.convertToOldISOCode(newCode[2]));
|
||||
// Ensure that the conversion is correct
|
||||
assertEquals("Conversion of new ISO codes not correct for " + newCode[0], oldCode[0], contentFilterLanguagesService.convertToOldISOCode(newCode[0]));
|
||||
assertEquals("Conversion of new ISO codes not correct for " + newCode[1], oldCode[1], contentFilterLanguagesService.convertToOldISOCode(newCode[1]));
|
||||
assertEquals("Conversion of new ISO codes not correct for " + newCode[2], oldCode[2], contentFilterLanguagesService.convertToOldISOCode(newCode[2]));
|
||||
|
||||
|
||||
assertEquals("Convertion of old ISO codes not correct for " + oldCode[0], newCode[0], contentFilterLanguagesService.convertToNewISOCode(oldCode[0]));
|
||||
assertEquals("Convertion of old ISO codes not correct for " + oldCode[1], newCode[1], contentFilterLanguagesService.convertToNewISOCode(oldCode[1]));
|
||||
assertEquals("Convertion of old ISO codes not correct for " + oldCode[2], newCode[2], contentFilterLanguagesService.convertToNewISOCode(oldCode[2]));
|
||||
assertEquals("Conversion of old ISO codes not correct for " + oldCode[0], newCode[0], contentFilterLanguagesService.convertToNewISOCode(oldCode[0]));
|
||||
assertEquals("Conversion of old ISO codes not correct for " + oldCode[1], newCode[1], contentFilterLanguagesService.convertToNewISOCode(oldCode[1]));
|
||||
assertEquals("Conversion of old ISO codes not correct for " + oldCode[2], newCode[2], contentFilterLanguagesService.convertToNewISOCode(oldCode[2]));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user