From 1a821500b12cfd3325fa41f2e8deea53d2ecaf02 Mon Sep 17 00:00:00 2001 From: mstrankowski Date: Tue, 19 Sep 2023 09:24:26 +0200 Subject: [PATCH] Migrated to Spring Boot 3, build completes, was forced to update to httpclient5 from apache. Need to verify no impact on ssl mechanism after changes --- deprecated/alfresco-transformer-base/pom.xml | 4 +- .../AbstractTransformerController.java | 2 +- .../transformer/QueueTransformService.java | 6 +-- .../transformer/TransformController.java | 4 +- .../transformer/TransformInterceptor.java | 8 ++-- .../transformer/TransformRegistryImpl.java | 2 +- .../AlfrescoSharedFileStoreClient.java | 5 ++- .../transformer/config/MTLSConfig.java | 39 +++++++++++++------ .../alfresco/transformer/fs/FileManager.java | 2 +- .../messaging/MessagingConfig.java | 4 +- .../transformer/messaging/MessagingInfo.java | 2 +- .../messaging/TransformMessageConverter.java | 6 +-- .../messaging/TransformReplySender.java | 2 +- .../probes/ProbeTestTransform.java | 2 +- .../transformer/AbstractHttpRequestTest.java | 2 +- .../AbstractQueueTransformServiceIT.java | 2 +- .../QueueTransformServiceTest.java | 6 +-- engines/base/pom.xml | 9 +---- .../transform/base/TransformController.java | 8 ++-- .../transform/base/config/MTLSConfig.java | 39 +++++++++++++------ .../transform/base/fs/FileManager.java | 2 +- .../base/html/TransformInterceptor.java | 5 +-- .../base/messaging/MessagingConfig.java | 4 +- .../base/messaging/MessagingInfo.java | 2 +- .../base/messaging/QueueTransformService.java | 6 +-- .../messaging/TransformMessageConverter.java | 6 +-- .../base/messaging/TransformReplySender.java | 2 +- .../base/registry/CustomTransformers.java | 2 +- .../registry/TransformConfigFromFiles.java | 2 +- .../TransformConfigFromTransformEngines.java | 2 +- .../base/sfs/SharedFileStoreClient.java | 7 ++-- .../base/transform/ProcessHandler.java | 4 +- .../base/transform/TransformHandler.java | 8 ++-- .../base/transform/TransformManagerImpl.java | 2 +- .../transform/base/MtlsTestUtils.java | 39 +++++++++++++++---- .../transform/base/clients/JmsClient.java | 18 ++++----- .../transform/base/clients/SfsClient.java | 35 +++++++++-------- .../base/messaging/AbstractQueueIT.java | 2 +- .../messaging/QueueTransformServiceTest.java | 6 +-- .../base/transform/FragmentHandlerTest.java | 2 +- .../transformers/ImageMagickTransformer.java | 2 +- .../JodConverterSharedInstance.java | 4 +- .../transformers/LibreOfficeTransformer.java | 2 +- engines/misc/pom.xml | 6 +-- .../RFC822MetadataExtractor.java | 10 ++--- .../misc/transformers/EMLTransformer.java | 10 ++--- .../transformers/PdfRendererTransformer.java | 2 +- pom.xml | 13 ++----- 48 files changed, 204 insertions(+), 155 deletions(-) diff --git a/deprecated/alfresco-transformer-base/pom.xml b/deprecated/alfresco-transformer-base/pom.xml index 94b432c89..082ca9427 100644 --- a/deprecated/alfresco-transformer-base/pom.xml +++ b/deprecated/alfresco-transformer-base/pom.xml @@ -71,8 +71,8 @@ pooled-jms - org.apache.httpcomponents - httpclient + org.apache.httpcomponents.client5 + httpclient5 com.google.guava diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/AbstractTransformerController.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/AbstractTransformerController.java index 219b280e0..7d32cb700 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/AbstractTransformerController.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/AbstractTransformerController.java @@ -56,7 +56,7 @@ import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.io.File; import java.io.IOException; import java.net.URL; diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/QueueTransformService.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/QueueTransformService.java index 1a891f314..99ee6b327 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/QueueTransformService.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/QueueTransformService.java @@ -31,9 +31,9 @@ import java.util.Optional; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; +import jakarta.jms.Destination; +import jakarta.jms.JMSException; +import jakarta.jms.Message; import org.alfresco.transform.client.model.TransformReply; import org.alfresco.transform.client.model.TransformRequest; diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformController.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformController.java index 37cf6f682..45b0de39e 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformController.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformController.java @@ -34,8 +34,8 @@ import java.util.Collection; import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.alfresco.transform.client.model.TransformReply; import org.alfresco.transform.client.model.TransformRequest; diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformInterceptor.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformInterceptor.java index 45292f67e..d66f156fd 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformInterceptor.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformInterceptor.java @@ -30,11 +30,11 @@ import static org.alfresco.transformer.fs.FileManager.TARGET_FILE; import static org.alfresco.transformer.fs.FileManager.deleteFile; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.alfresco.transformer.logging.LogEntry; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import org.springframework.web.servlet.AsyncHandlerInterceptor; /** * @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine. @@ -44,7 +44,7 @@ * Handles ThreadLocal Log entries for each request. */ @Deprecated -public class TransformInterceptor extends HandlerInterceptorAdapter +public class TransformInterceptor implements AsyncHandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformRegistryImpl.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformRegistryImpl.java index 7282841ff..b3aeccff5 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformRegistryImpl.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/TransformRegistryImpl.java @@ -33,7 +33,7 @@ import java.io.InputStreamReader; import java.io.Reader; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.alfresco.transform.config.TransformConfig; import org.alfresco.transform.registry.AbstractTransformRegistry; diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/clients/AlfrescoSharedFileStoreClient.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/clients/AlfrescoSharedFileStoreClient.java index 60ddd6a49..8fe4299e0 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/clients/AlfrescoSharedFileStoreClient.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/clients/AlfrescoSharedFileStoreClient.java @@ -39,6 +39,7 @@ import org.springframework.core.io.Resource; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.util.LinkedMultiValueMap; import org.springframework.web.client.HttpClientErrorException; @@ -73,7 +74,7 @@ public ResponseEntity retrieveFile(String fileRef) } catch (HttpClientErrorException e) { - throw new TransformException(e.getStatusCode(), e.getMessage(), e); + throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), e.getMessage(), e); } } @@ -100,7 +101,7 @@ public FileRefResponse saveFile(File file) } catch (HttpClientErrorException e) { - throw new TransformException(e.getStatusCode(), e.getMessage(), e); + throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), e.getMessage(), e); } } } diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/config/MTLSConfig.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/config/MTLSConfig.java index e0446bd6c..a69258d83 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/config/MTLSConfig.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/config/MTLSConfig.java @@ -26,12 +26,18 @@ */ package org.alfresco.transformer.config; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.ssl.SSLContextBuilder; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager; +import org.apache.hc.client5.http.socket.ConnectionSocketFactory; +import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder; +import org.apache.hc.core5.http.config.Registry; +import org.apache.hc.core5.http.config.RegistryBuilder; +import org.apache.hc.core5.http.ssl.TLS; +import org.apache.hc.core5.ssl.SSLContextBuilder; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -40,7 +46,6 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; -import javax.net.ssl.SSLContext; import java.io.IOException; import java.io.InputStream; import java.security.KeyManagementException; @@ -120,11 +125,23 @@ private boolean isKeystoreConfigured() } private RestTemplate createRestTemplateWithSslContext(SSLContextBuilder sslContextBuilder) throws NoSuchAlgorithmException, KeyManagementException { - SSLContext sslContext = sslContextBuilder.build(); - SSLConnectionSocketFactory sslContextFactory = hostNameVerificationDisabled ? new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE) - : new SSLConnectionSocketFactory(sslContext); + final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder = + SSLConnectionSocketFactoryBuilder.create() + .setSslContext(sslContextBuilder.build()) + .setTlsVersions(TLS.V_1_2, TLS.V_1_3); + if (hostNameVerificationDisabled) { + sslConnectionSocketFactoryBuilder.setHostnameVerifier(NoopHostnameVerifier.INSTANCE); + } + final SSLConnectionSocketFactory sslConnectionSocketFactory = sslConnectionSocketFactoryBuilder.build(); + + final Registry sslSocketFactoryRegistry = + RegistryBuilder. create() + .register("https", sslConnectionSocketFactory) + .build(); + + final BasicHttpClientConnectionManager sslConnectionManager = new BasicHttpClientConnectionManager(sslSocketFactoryRegistry); - HttpClientBuilder httpClientBuilder = HttpClients.custom().setSSLSocketFactory(sslContextFactory); + HttpClientBuilder httpClientBuilder = HttpClients.custom().setConnectionManager(sslConnectionManager); CloseableHttpClient httpClient = httpClientBuilder.build(); ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); return new RestTemplate(requestFactory); diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java index ffdb1c89a..cf01c3994 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/fs/FileManager.java @@ -40,7 +40,7 @@ import java.nio.file.StandardCopyOption; import java.util.Arrays; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.alfresco.transform.exceptions.TransformException; import org.alfresco.transformer.logging.LogEntry; diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingConfig.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingConfig.java index 766e59239..112ca34e8 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingConfig.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingConfig.java @@ -26,8 +26,8 @@ */ package org.alfresco.transformer.messaging; -import javax.jms.ConnectionFactory; -import javax.jms.Queue; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.Queue; import org.alfresco.transform.messages.TransformRequestValidator; import org.apache.activemq.command.ActiveMQQueue; diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingInfo.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingInfo.java index 7b5e311ec..c1e0293bd 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingInfo.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/MessagingInfo.java @@ -26,7 +26,7 @@ */ package org.alfresco.transformer.messaging; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformMessageConverter.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformMessageConverter.java index 3c65626b7..a1e7ec301 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformMessageConverter.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformMessageConverter.java @@ -39,9 +39,9 @@ import org.springframework.lang.NonNull; import org.springframework.stereotype.Service; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Session; +import jakarta.jms.JMSException; +import jakarta.jms.Message; +import jakarta.jms.Session; /** * @deprecated will be removed in a future release. Replaced by alfresco-base-t-engine. diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformReplySender.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformReplySender.java index 0cf05228b..7787b858e 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformReplySender.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/messaging/TransformReplySender.java @@ -26,7 +26,7 @@ */ package org.alfresco.transformer.messaging; -import javax.jms.Destination; +import jakarta.jms.Destination; import org.alfresco.transform.client.model.TransformReply; import org.slf4j.Logger; diff --git a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/probes/ProbeTestTransform.java b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/probes/ProbeTestTransform.java index 65b428296..f4d73ec80 100644 --- a/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/probes/ProbeTestTransform.java +++ b/deprecated/alfresco-transformer-base/src/main/java/org/alfresco/transformer/probes/ProbeTestTransform.java @@ -42,7 +42,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.alfresco.transform.exceptions.TransformException; import org.alfresco.transformer.AbstractTransformerController; diff --git a/deprecated/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractHttpRequestTest.java b/deprecated/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractHttpRequestTest.java index 4f1527935..7463666c1 100644 --- a/deprecated/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractHttpRequestTest.java +++ b/deprecated/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractHttpRequestTest.java @@ -36,7 +36,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; diff --git a/deprecated/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractQueueTransformServiceIT.java b/deprecated/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractQueueTransformServiceIT.java index 3866458fa..97dc5146e 100644 --- a/deprecated/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractQueueTransformServiceIT.java +++ b/deprecated/alfresco-transformer-base/src/test/java/org/alfresco/transformer/AbstractQueueTransformServiceIT.java @@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import javax.jms.Queue; +import jakarta.jms.Queue; import org.alfresco.transform.client.model.TransformReply; import org.alfresco.transform.client.model.TransformRequest; diff --git a/deprecated/alfresco-transformer-base/src/test/java/org/alfresco/transformer/QueueTransformServiceTest.java b/deprecated/alfresco-transformer-base/src/test/java/org/alfresco/transformer/QueueTransformServiceTest.java index 485297ba7..ac07577b7 100644 --- a/deprecated/alfresco-transformer-base/src/test/java/org/alfresco/transformer/QueueTransformServiceTest.java +++ b/deprecated/alfresco-transformer-base/src/test/java/org/alfresco/transformer/QueueTransformServiceTest.java @@ -36,9 +36,9 @@ import static org.springframework.http.HttpStatus.CREATED; import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; +import jakarta.jms.Destination; +import jakarta.jms.JMSException; +import jakarta.jms.Message; import org.alfresco.transform.client.model.TransformReply; import org.alfresco.transform.client.model.TransformRequest; diff --git a/engines/base/pom.xml b/engines/base/pom.xml index e18e594fc..4f32500c1 100644 --- a/engines/base/pom.xml +++ b/engines/base/pom.xml @@ -88,13 +88,8 @@ logback-classic - org.apache.httpcomponents - httpclient - - - org.apache.httpcomponents - httpmime - test + org.apache.httpcomponents.client5 + httpclient5 org.awaitility diff --git a/engines/base/src/main/java/org/alfresco/transform/base/TransformController.java b/engines/base/src/main/java/org/alfresco/transform/base/TransformController.java index 500345b54..2051567a1 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/TransformController.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/TransformController.java @@ -57,10 +57,10 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; -import javax.annotation.PostConstruct; -import javax.jms.Destination; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.annotation.PostConstruct; +import jakarta.jms.Destination; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Arrays; import java.util.Collection; diff --git a/engines/base/src/main/java/org/alfresco/transform/base/config/MTLSConfig.java b/engines/base/src/main/java/org/alfresco/transform/base/config/MTLSConfig.java index 9e7d7b64c..d8be89c53 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/config/MTLSConfig.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/config/MTLSConfig.java @@ -29,12 +29,18 @@ import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslContextBuilder; import org.alfresco.transform.base.WebClientBuilderAdjuster; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.ssl.SSLContextBuilder; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager; +import org.apache.hc.client5.http.socket.ConnectionSocketFactory; +import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder; +import org.apache.hc.core5.http.config.Registry; +import org.apache.hc.core5.http.config.RegistryBuilder; +import org.apache.hc.core5.http.ssl.TLS; +import org.apache.hc.core5.ssl.SSLContextBuilder; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -46,7 +52,6 @@ import reactor.netty.http.client.HttpClient; import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLException; import javax.net.ssl.SSLParameters; @@ -179,11 +184,23 @@ private HttpClient createHttpClientWithSslContext(SslContextBuilder sslContextBu } private RestTemplate createRestTemplateWithSslContext(SSLContextBuilder sslContextBuilder) throws NoSuchAlgorithmException, KeyManagementException { - SSLContext sslContext = sslContextBuilder.build(); - SSLConnectionSocketFactory sslContextFactory = hostNameVerificationDisabled ? new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE) - : new SSLConnectionSocketFactory(sslContext); + final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder = + SSLConnectionSocketFactoryBuilder.create() + .setSslContext(sslContextBuilder.build()) + .setTlsVersions(TLS.V_1_2, TLS.V_1_3); + if (hostNameVerificationDisabled) { + sslConnectionSocketFactoryBuilder.setHostnameVerifier(NoopHostnameVerifier.INSTANCE); + } + final SSLConnectionSocketFactory sslConnectionSocketFactory = sslConnectionSocketFactoryBuilder.build(); + + final Registry sslSocketFactoryRegistry = + RegistryBuilder. create() + .register("https", sslConnectionSocketFactory) + .build(); + + final BasicHttpClientConnectionManager sslConnectionManager = new BasicHttpClientConnectionManager(sslSocketFactoryRegistry); - HttpClientBuilder httpClientBuilder = HttpClients.custom().setSSLSocketFactory(sslContextFactory); + HttpClientBuilder httpClientBuilder = HttpClients.custom().setConnectionManager(sslConnectionManager); CloseableHttpClient httpClient = httpClientBuilder.build(); ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); return new RestTemplate(requestFactory); diff --git a/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java b/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java index c3642840b..62eb77bd0 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java @@ -35,7 +35,7 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.util.UriUtils; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.io.File; import java.io.IOException; import java.io.InputStream; diff --git a/engines/base/src/main/java/org/alfresco/transform/base/html/TransformInterceptor.java b/engines/base/src/main/java/org/alfresco/transform/base/html/TransformInterceptor.java index 5ec19e867..7f5c76f2e 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/html/TransformInterceptor.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/html/TransformInterceptor.java @@ -30,11 +30,10 @@ import static org.alfresco.transform.base.fs.FileManager.TARGET_FILE; import static org.alfresco.transform.base.fs.FileManager.deleteFile; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.web.servlet.AsyncHandlerInterceptor; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; /** * Cleans up temporary files in transform requests that upload the content and download the result. diff --git a/engines/base/src/main/java/org/alfresco/transform/base/messaging/MessagingConfig.java b/engines/base/src/main/java/org/alfresco/transform/base/messaging/MessagingConfig.java index 04a8a2fee..988332f25 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/messaging/MessagingConfig.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/messaging/MessagingConfig.java @@ -40,8 +40,8 @@ import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory; import org.springframework.transaction.PlatformTransactionManager; -import javax.jms.ConnectionFactory; -import javax.jms.Queue; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.Queue; /** * JMS and messaging configuration for the T-Engines. Contains the basic config in order to have the diff --git a/engines/base/src/main/java/org/alfresco/transform/base/messaging/MessagingInfo.java b/engines/base/src/main/java/org/alfresco/transform/base/messaging/MessagingInfo.java index eb3536045..b7a081a20 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/messaging/MessagingInfo.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/messaging/MessagingInfo.java @@ -26,7 +26,7 @@ */ package org.alfresco.transform.base.messaging; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/engines/base/src/main/java/org/alfresco/transform/base/messaging/QueueTransformService.java b/engines/base/src/main/java/org/alfresco/transform/base/messaging/QueueTransformService.java index c03ca28ea..e1f9d36e7 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/messaging/QueueTransformService.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/messaging/QueueTransformService.java @@ -39,9 +39,9 @@ import org.springframework.jms.support.converter.MessageConversionException; import org.springframework.stereotype.Component; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; +import jakarta.jms.Destination; +import jakarta.jms.JMSException; +import jakarta.jms.Message; import java.util.Optional; import static org.springframework.http.HttpStatus.BAD_REQUEST; diff --git a/engines/base/src/main/java/org/alfresco/transform/base/messaging/TransformMessageConverter.java b/engines/base/src/main/java/org/alfresco/transform/base/messaging/TransformMessageConverter.java index ab549f494..1d264b76d 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/messaging/TransformMessageConverter.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/messaging/TransformMessageConverter.java @@ -39,9 +39,9 @@ import org.springframework.lang.NonNull; import org.springframework.stereotype.Service; -import javax.jms.JMSException; -import javax.jms.Message; -import javax.jms.Session; +import jakarta.jms.JMSException; +import jakarta.jms.Message; +import jakarta.jms.Session; /** * Copied from the t-router. We would need to create a common dependency between t-engine base and t-router that diff --git a/engines/base/src/main/java/org/alfresco/transform/base/messaging/TransformReplySender.java b/engines/base/src/main/java/org/alfresco/transform/base/messaging/TransformReplySender.java index 3343e3ccb..9dd038c7d 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/messaging/TransformReplySender.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/messaging/TransformReplySender.java @@ -26,7 +26,7 @@ */ package org.alfresco.transform.base.messaging; -import javax.jms.Destination; +import jakarta.jms.Destination; import org.alfresco.transform.client.model.TransformReply; import org.slf4j.Logger; diff --git a/engines/base/src/main/java/org/alfresco/transform/base/registry/CustomTransformers.java b/engines/base/src/main/java/org/alfresco/transform/base/registry/CustomTransformers.java index bd1678cf5..606eddaae 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/registry/CustomTransformers.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/registry/CustomTransformers.java @@ -32,7 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/engines/base/src/main/java/org/alfresco/transform/base/registry/TransformConfigFromFiles.java b/engines/base/src/main/java/org/alfresco/transform/base/registry/TransformConfigFromFiles.java index 46456e154..ddb9c5333 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/registry/TransformConfigFromFiles.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/registry/TransformConfigFromFiles.java @@ -35,7 +35,7 @@ import org.springframework.core.io.Resource; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/engines/base/src/main/java/org/alfresco/transform/base/registry/TransformConfigFromTransformEngines.java b/engines/base/src/main/java/org/alfresco/transform/base/registry/TransformConfigFromTransformEngines.java index 06ef845e9..113ae5932 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/registry/TransformConfigFromTransformEngines.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/registry/TransformConfigFromTransformEngines.java @@ -32,7 +32,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.util.List; /** diff --git a/engines/base/src/main/java/org/alfresco/transform/base/sfs/SharedFileStoreClient.java b/engines/base/src/main/java/org/alfresco/transform/base/sfs/SharedFileStoreClient.java index b54f07ef8..e1913efb5 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/sfs/SharedFileStoreClient.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/sfs/SharedFileStoreClient.java @@ -45,6 +45,7 @@ import org.springframework.core.io.Resource; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -53,7 +54,7 @@ import org.springframework.web.client.RestTemplate; import org.springframework.web.reactive.function.client.WebClient; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import javax.net.ssl.SSLException; /** @@ -100,7 +101,7 @@ public ResponseEntity retrieveFile(String fileRef) } catch (HttpClientErrorException e) { - throw new TransformException(e.getStatusCode(), e.getMessage(), e); + throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), e.getMessage(), e); } } @@ -127,7 +128,7 @@ public FileRefResponse saveFile(File file) } catch (HttpClientErrorException e) { - throw new TransformException(e.getStatusCode(), e.getMessage(), e); + throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), e.getMessage(), e); } } diff --git a/engines/base/src/main/java/org/alfresco/transform/base/transform/ProcessHandler.java b/engines/base/src/main/java/org/alfresco/transform/base/transform/ProcessHandler.java index 91ed0d636..05c337bc3 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/transform/ProcessHandler.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/transform/ProcessHandler.java @@ -37,8 +37,8 @@ import org.alfresco.transform.registry.TransformServiceRegistry; import org.springframework.web.multipart.MultipartFile; -import javax.jms.Destination; -import javax.servlet.http.HttpServletRequest; +import jakarta.jms.Destination; +import jakarta.servlet.http.HttpServletRequest; import java.io.File; import java.io.IOException; import java.util.Arrays; diff --git a/engines/base/src/main/java/org/alfresco/transform/base/transform/TransformHandler.java b/engines/base/src/main/java/org/alfresco/transform/base/transform/TransformHandler.java index 7c4c65246..5e1546b8f 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/transform/TransformHandler.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/transform/TransformHandler.java @@ -52,8 +52,8 @@ import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.multipart.MultipartFile; -import javax.jms.Destination; -import javax.servlet.http.HttpServletRequest; +import jakarta.jms.Destination; +import jakarta.servlet.http.HttpServletRequest; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; @@ -372,7 +372,7 @@ private InputStream getInputStreamForHandleMessageRequest(TransformRequest reque } catch (HttpClientErrorException e) { - throw new TransformException(e.getStatusCode(), messageWithCause("Failed to read the source from the SFS", e)); + throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), messageWithCause("Failed to read the source from the SFS", e)); } } @@ -394,7 +394,7 @@ private void saveTargetFileInSharedFileStore(File targetFile, TransformReply rep } catch (HttpClientErrorException e) { - throw new TransformException(e.getStatusCode(), messageWithCause(FAILED_WRITING_TO_SFS, e)); + throw new TransformException(HttpStatus.resolve(e.getStatusCode().value()), messageWithCause(FAILED_WRITING_TO_SFS, e)); } catch (Exception e) { diff --git a/engines/base/src/main/java/org/alfresco/transform/base/transform/TransformManagerImpl.java b/engines/base/src/main/java/org/alfresco/transform/base/transform/TransformManagerImpl.java index db9105217..629bbfcf5 100644 --- a/engines/base/src/main/java/org/alfresco/transform/base/transform/TransformManagerImpl.java +++ b/engines/base/src/main/java/org/alfresco/transform/base/transform/TransformManagerImpl.java @@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.io.File; import java.io.IOException; import java.io.InputStream; diff --git a/engines/base/src/test/java/org/alfresco/transform/base/MtlsTestUtils.java b/engines/base/src/test/java/org/alfresco/transform/base/MtlsTestUtils.java index 63f8ffddb..15a38d3aa 100644 --- a/engines/base/src/test/java/org/alfresco/transform/base/MtlsTestUtils.java +++ b/engines/base/src/test/java/org/alfresco/transform/base/MtlsTestUtils.java @@ -1,10 +1,17 @@ package org.alfresco.transform.base; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.ssl.SSLContextBuilder; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager; +import org.apache.hc.client5.http.io.HttpClientConnectionManager; +import org.apache.hc.client5.http.socket.ConnectionSocketFactory; +import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder; +import org.apache.hc.core5.http.config.Registry; +import org.apache.hc.core5.http.config.RegistryBuilder; +import org.apache.hc.core5.http.ssl.TLS; +import org.apache.hc.core5.ssl.SSLContextBuilder; import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; @@ -59,10 +66,26 @@ public static CloseableHttpClient httpClientWithMtls() throws NoSuchAlgorithmExc .loadTrustMaterial(trustStore, trustStorePassword); SSLContext sslContext = sslContextBuilder.build(); - SSLConnectionSocketFactory sslContextFactory = HOSTNAME_VERIFICATION_DISABLED ? new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE) - : new SSLConnectionSocketFactory(sslContext); - return HttpClients.custom().setSSLSocketFactory(sslContextFactory).build(); + return HttpClients.custom().setConnectionManager(buildSslConnectionManager(sslContext)).build(); + } + + private static HttpClientConnectionManager buildSslConnectionManager(SSLContext sslContext) { + final SSLConnectionSocketFactoryBuilder sslConnectionSocketFactoryBuilder = + SSLConnectionSocketFactoryBuilder.create() + .setSslContext(sslContext) + .setTlsVersions(TLS.V_1_2, TLS.V_1_3); + if (HOSTNAME_VERIFICATION_DISABLED) { + sslConnectionSocketFactoryBuilder.setHostnameVerifier(NoopHostnameVerifier.INSTANCE); + } + final SSLConnectionSocketFactory sslConnectionSocketFactory = sslConnectionSocketFactoryBuilder.build(); + + final Registry sslSocketFactoryRegistry = + RegistryBuilder. create() + .register("https", sslConnectionSocketFactory) + .build(); + + return new BasicHttpClientConnectionManager(sslSocketFactoryRegistry); } public static RestTemplate restTemplateWithMtls() diff --git a/engines/base/src/test/java/org/alfresco/transform/base/clients/JmsClient.java b/engines/base/src/test/java/org/alfresco/transform/base/clients/JmsClient.java index b450460a3..c3f96da30 100644 --- a/engines/base/src/test/java/org/alfresco/transform/base/clients/JmsClient.java +++ b/engines/base/src/test/java/org/alfresco/transform/base/clients/JmsClient.java @@ -8,15 +8,15 @@ package org.alfresco.transform.base.clients; -import javax.jms.BytesMessage; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.DeliveryMode; -import javax.jms.Destination; -import javax.jms.MessageConsumer; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.TextMessage; +import jakarta.jms.BytesMessage; +import jakarta.jms.Connection; +import jakarta.jms.ConnectionFactory; +import jakarta.jms.DeliveryMode; +import jakarta.jms.Destination; +import jakarta.jms.MessageConsumer; +import jakarta.jms.MessageProducer; +import jakarta.jms.Session; +import jakarta.jms.TextMessage; import org.alfresco.transform.client.model.TransformReply; import org.alfresco.transform.client.model.TransformRequest; diff --git a/engines/base/src/test/java/org/alfresco/transform/base/clients/SfsClient.java b/engines/base/src/test/java/org/alfresco/transform/base/clients/SfsClient.java index f31db5da3..53d91fa3d 100644 --- a/engines/base/src/test/java/org/alfresco/transform/base/clients/SfsClient.java +++ b/engines/base/src/test/java/org/alfresco/transform/base/clients/SfsClient.java @@ -22,17 +22,18 @@ import java.nio.file.StandardCopyOption; import org.alfresco.transform.base.MtlsTestUtils; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpHead; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.mime.HttpMultipartMode; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.util.EntityUtils; +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.classic.methods.HttpHead; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.client5.http.entity.mime.FileBody; +import org.apache.hc.client5.http.entity.mime.HttpMultipartMode; +import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.HttpEntity; +import org.apache.hc.core5.http.HttpEntityContainer; +import org.apache.hc.core5.http.HttpResponse; +import org.apache.hc.core5.http.io.entity.EntityUtils; import org.slf4j.LoggerFactory; import com.google.common.collect.ImmutableMap; @@ -71,17 +72,17 @@ public static String uploadFile(final String fileToUploadName, final String sfsB sfsBaseUrl+"/alfresco/api/-default-/private/sfs/versions/1/file"); post.setEntity(MultipartEntityBuilder .create() - .setMode(HttpMultipartMode.BROWSER_COMPATIBLE) + .setMode(HttpMultipartMode.LEGACY) .addPart("file", new FileBody(file, ContentType.DEFAULT_BINARY)) .build()); try (CloseableHttpClient client = MtlsTestUtils.getHttpClient()) { final HttpResponse response = client.execute(post); - int status = response.getStatusLine().getStatusCode(); + int status = response.getCode(); if (status >= 200 && status < 300) { - return JacksonSerializer.readStringValue(EntityUtils.toString(response.getEntity()), + return JacksonSerializer.readStringValue(EntityUtils.toString(((HttpEntityContainer) response).getEntity()), "entry.fileRef"); } else @@ -137,7 +138,7 @@ public static boolean checkFile(final String uuid, final String sfsBaseUrl) thro try (CloseableHttpClient client = MtlsTestUtils.getHttpClient()) { final HttpResponse response = client.execute(head); - final int status = response.getStatusLine().getStatusCode(); + final int status = response.getCode(); return status >= 200 && status < 300; } } @@ -156,12 +157,12 @@ public static File downloadFile(final String uuid, final String sfsBaseUrl) thro try (CloseableHttpClient client = MtlsTestUtils.getHttpClient()) { final HttpResponse response = client.execute(get); - final int status = response.getStatusLine().getStatusCode(); + final int status = response.getCode(); if (status < 200 || status >= 300) { throw new Exception("File with UUID " + uuid + " was not found on SFS"); } - final HttpEntity entity = response.getEntity(); + final HttpEntity entity = ((HttpEntityContainer) response).getEntity(); if (entity == null) { throw new Exception("Failed to read HTTP reply entity for file with UUID " + uuid); diff --git a/engines/base/src/test/java/org/alfresco/transform/base/messaging/AbstractQueueIT.java b/engines/base/src/test/java/org/alfresco/transform/base/messaging/AbstractQueueIT.java index 3696e90ec..43ce4f487 100644 --- a/engines/base/src/test/java/org/alfresco/transform/base/messaging/AbstractQueueIT.java +++ b/engines/base/src/test/java/org/alfresco/transform/base/messaging/AbstractQueueIT.java @@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -import javax.jms.Queue; +import jakarta.jms.Queue; import org.alfresco.transform.client.model.TransformReply; import org.alfresco.transform.client.model.TransformRequest; diff --git a/engines/base/src/test/java/org/alfresco/transform/base/messaging/QueueTransformServiceTest.java b/engines/base/src/test/java/org/alfresco/transform/base/messaging/QueueTransformServiceTest.java index 93ec08dd3..d56df7e89 100644 --- a/engines/base/src/test/java/org/alfresco/transform/base/messaging/QueueTransformServiceTest.java +++ b/engines/base/src/test/java/org/alfresco/transform/base/messaging/QueueTransformServiceTest.java @@ -38,9 +38,9 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.jms.support.converter.MessageConversionException; -import javax.jms.Destination; -import javax.jms.JMSException; -import javax.jms.Message; +import jakarta.jms.Destination; +import jakarta.jms.JMSException; +import jakarta.jms.Message; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; diff --git a/engines/base/src/test/java/org/alfresco/transform/base/transform/FragmentHandlerTest.java b/engines/base/src/test/java/org/alfresco/transform/base/transform/FragmentHandlerTest.java index c05d0254d..4dc74dd6b 100644 --- a/engines/base/src/test/java/org/alfresco/transform/base/transform/FragmentHandlerTest.java +++ b/engines/base/src/test/java/org/alfresco/transform/base/transform/FragmentHandlerTest.java @@ -51,7 +51,7 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import javax.jms.Destination; +import jakarta.jms.Destination; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; diff --git a/engines/imagemagick/src/main/java/org/alfresco/transform/imagemagick/transformers/ImageMagickTransformer.java b/engines/imagemagick/src/main/java/org/alfresco/transform/imagemagick/transformers/ImageMagickTransformer.java index f694b21d4..c65325e6b 100644 --- a/engines/imagemagick/src/main/java/org/alfresco/transform/imagemagick/transformers/ImageMagickTransformer.java +++ b/engines/imagemagick/src/main/java/org/alfresco/transform/imagemagick/transformers/ImageMagickTransformer.java @@ -52,7 +52,7 @@ import static org.alfresco.transform.common.RequestParamMap.THUMBNAIL; import static org.alfresco.transform.common.RequestParamMap.TIMEOUT; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.io.File; import java.util.HashMap; import java.util.List; diff --git a/engines/libreoffice/src/main/java/org/alfresco/transform/libreoffice/transformers/JodConverterSharedInstance.java b/engines/libreoffice/src/main/java/org/alfresco/transform/libreoffice/transformers/JodConverterSharedInstance.java index 495ecfeec..1e36a2747 100644 --- a/engines/libreoffice/src/main/java/org/alfresco/transform/libreoffice/transformers/JodConverterSharedInstance.java +++ b/engines/libreoffice/src/main/java/org/alfresco/transform/libreoffice/transformers/JodConverterSharedInstance.java @@ -34,8 +34,8 @@ import java.util.List; import java.util.StringTokenizer; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; +import jakarta.annotation.PostConstruct; +import jakarta.annotation.PreDestroy; import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration; import org.artofsolving.jodconverter.office.OfficeException; diff --git a/engines/libreoffice/src/main/java/org/alfresco/transform/libreoffice/transformers/LibreOfficeTransformer.java b/engines/libreoffice/src/main/java/org/alfresco/transform/libreoffice/transformers/LibreOfficeTransformer.java index 823251064..70a1b1f06 100644 --- a/engines/libreoffice/src/main/java/org/alfresco/transform/libreoffice/transformers/LibreOfficeTransformer.java +++ b/engines/libreoffice/src/main/java/org/alfresco/transform/libreoffice/transformers/LibreOfficeTransformer.java @@ -44,7 +44,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.io.File; import java.io.IOException; import java.io.Serializable; diff --git a/engines/misc/pom.xml b/engines/misc/pom.xml index 0f5cb8ace..6623f38e0 100644 --- a/engines/misc/pom.xml +++ b/engines/misc/pom.xml @@ -72,9 +72,9 @@ - com.sun.mail - javax.mail - 1.6.2 + jakarta.mail + jakarta.mail-api + 2.1.2 diff --git a/engines/misc/src/main/java/org/alfresco/transform/misc/metadataExtractors/RFC822MetadataExtractor.java b/engines/misc/src/main/java/org/alfresco/transform/misc/metadataExtractors/RFC822MetadataExtractor.java index f47ad75f9..c282513f8 100644 --- a/engines/misc/src/main/java/org/alfresco/transform/misc/metadataExtractors/RFC822MetadataExtractor.java +++ b/engines/misc/src/main/java/org/alfresco/transform/misc/metadataExtractors/RFC822MetadataExtractor.java @@ -32,11 +32,11 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.mail.Header; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMessage.RecipientType; -import javax.mail.internet.MimeUtility; +import jakarta.mail.Header; +import jakarta.mail.internet.InternetAddress; +import jakarta.mail.internet.MimeMessage; +import jakarta.mail.internet.MimeMessage.RecipientType; +import jakarta.mail.internet.MimeUtility; import java.io.InputStream; import java.io.OutputStream; import java.io.Serializable; diff --git a/engines/misc/src/main/java/org/alfresco/transform/misc/transformers/EMLTransformer.java b/engines/misc/src/main/java/org/alfresco/transform/misc/transformers/EMLTransformer.java index b2de56d3b..6e86f0af7 100644 --- a/engines/misc/src/main/java/org/alfresco/transform/misc/transformers/EMLTransformer.java +++ b/engines/misc/src/main/java/org/alfresco/transform/misc/transformers/EMLTransformer.java @@ -33,11 +33,11 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import javax.mail.MessagingException; -import javax.mail.Multipart; -import javax.mail.Part; -import javax.mail.Session; -import javax.mail.internet.MimeMessage; +import jakarta.mail.MessagingException; +import jakarta.mail.Multipart; +import jakarta.mail.Part; +import jakarta.mail.Session; +import jakarta.mail.internet.MimeMessage; import java.io.BufferedInputStream; import java.io.BufferedWriter; import java.io.File; diff --git a/engines/pdfrenderer/src/main/java/org/alfresco/transform/pdfrenderer/transformers/PdfRendererTransformer.java b/engines/pdfrenderer/src/main/java/org/alfresco/transform/pdfrenderer/transformers/PdfRendererTransformer.java index 82b4a515b..4c7195858 100644 --- a/engines/pdfrenderer/src/main/java/org/alfresco/transform/pdfrenderer/transformers/PdfRendererTransformer.java +++ b/engines/pdfrenderer/src/main/java/org/alfresco/transform/pdfrenderer/transformers/PdfRendererTransformer.java @@ -35,7 +35,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.io.File; import java.util.HashMap; import java.util.Map; diff --git a/pom.xml b/pom.xml index bff57b055..e2e744350 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 2.7.14 + 3.1.3 @@ -220,14 +220,9 @@ 1.16.0 - org.apache.httpcomponents - httpclient - 4.5.14 - - - org.apache.httpcomponents - httpmime - 4.5.14 + org.apache.httpcomponents.client5 + httpclient5 + 5.2 org.yaml