You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/04/13 13:35:11 UTC
[camel] 01/12: CAMEL-17962: cleanup duplicated charset features in camel-as2
This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 98189abbdbc162a764744806497e70d9911ef223
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Apr 13 13:37:30 2022 +0200
CAMEL-17962: cleanup duplicated charset features in camel-as2
---
.../apache/camel/component/as2/api/AS2Charset.java | 30 -------------------
.../camel/component/as2/api/AS2ClientManager.java | 9 +++---
.../AS2MessageDispositionNotificationEntity.java | 4 +--
.../as2/api/entity/ApplicationEDIEntity.java | 4 +--
.../ApplicationPkcs7MimeCompressedDataEntity.java | 4 +--
.../ApplicationPkcs7MimeEnvelopedDataEntity.java | 4 +--
.../entity/ApplicationPkcs7SignatureEntity.java | 4 +--
...spositionNotificationMultipartReportEntity.java | 4 +--
.../component/as2/api/entity/EntityParser.java | 26 ++++++++---------
.../camel/component/as2/api/entity/MimeEntity.java | 6 ++--
.../component/as2/api/entity/TextPlainEntity.java | 6 ++--
.../component/as2/api/protocol/ResponseMDN.java | 8 ++---
.../camel/component/as2/api/util/MicUtils.java | 4 +--
.../camel/component/as2/api/AS2MessageTest.java | 27 ++++++++---------
.../component/as2/api/util/EntityUtilsTest.java | 5 ++--
.../camel/component/as2/api/util/MicUtilsTest.java | 4 +--
.../camel/component/as2/AS2ClientManagerIT.java | 34 +++++++++++-----------
.../camel/component/as2/AS2ServerManagerIT.java | 10 +++----
18 files changed, 83 insertions(+), 110 deletions(-)
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2Charset.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2Charset.java
deleted file mode 100644
index 77c698f2b17..00000000000
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2Charset.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.as2.api;
-
-public interface AS2Charset {
-
- /**
- * Name of charset parameter in Content-Type header values.
- */
- String PARAM = "charset";
-
- /**
- * Character Set Name for US ASCII
- */
- String US_ASCII = "US-ASCII";
-}
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientManager.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientManager.java
index 6690745ab39..955a9f4ca72 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientManager.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ClientManager.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.as2.api;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.security.cert.Certificate;
@@ -267,7 +268,7 @@ public class AS2ClientManager {
AS2SignedDataGenerator signingGenrator = createSigningGenerator(httpContext);
MultipartSignedEntity multipartSignedEntity = new MultipartSignedEntity(
applicationEDIEntity, signingGenrator,
- AS2Charset.US_ASCII, AS2TransferEncoding.BASE64, true, null);
+ StandardCharsets.US_ASCII.name(), AS2TransferEncoding.BASE64, true, null);
// Add Multipart Signed Entity to main body of request.
EntityUtils.setMessageEntity(request, multipartSignedEntity);
@@ -290,7 +291,7 @@ public class AS2ClientManager {
AS2SignedDataGenerator signingGenrator = createSigningGenerator(httpContext);
MultipartSignedEntity multipartSignedEntity = new MultipartSignedEntity(
applicationEDIEntity,
- signingGenrator, AS2Charset.US_ASCII, AS2TransferEncoding.BASE64, false, null);
+ signingGenrator, StandardCharsets.US_ASCII.name(), AS2TransferEncoding.BASE64, false, null);
// Create Enveloped Entity containing Multipart Signed Entity
CMSEnvelopedDataGenerator envelopedDataGenerator = createEncryptingGenerator(httpContext);
@@ -320,7 +321,7 @@ public class AS2ClientManager {
AS2SignedDataGenerator signingGenrator = createSigningGenerator(httpContext);
MultipartSignedEntity multipartSignedEntity = new MultipartSignedEntity(
applicationEDIEntity,
- signingGenrator, AS2Charset.US_ASCII, AS2TransferEncoding.BASE64, false, null);
+ signingGenrator, StandardCharsets.US_ASCII.name(), AS2TransferEncoding.BASE64, false, null);
// Create Compressed Entity containing Multipart Signed Entity
CMSCompressedDataGenerator compressedDataGenerator = createCompressorGenerator(httpContext);
@@ -358,7 +359,7 @@ public class AS2ClientManager {
AS2SignedDataGenerator signingGenrator = createSigningGenerator(httpContext);
MultipartSignedEntity multipartSignedEntity = new MultipartSignedEntity(
applicationEDIEntity, signingGenrator,
- AS2Charset.US_ASCII, AS2TransferEncoding.BASE64, false, null);
+ StandardCharsets.US_ASCII.name(), AS2TransferEncoding.BASE64, false, null);
// Create Compressed Entity containing Multipart Signed Entity
CMSCompressedDataGenerator compressedDataGenerator = createCompressorGenerator(httpContext);
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/AS2MessageDispositionNotificationEntity.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/AS2MessageDispositionNotificationEntity.java
index 6614b044227..13d141fbae2 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/AS2MessageDispositionNotificationEntity.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/AS2MessageDispositionNotificationEntity.java
@@ -18,12 +18,12 @@ package org.apache.camel.component.as2.api.entity;
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2Header;
import org.apache.camel.component.as2.api.AS2MimeType;
import org.apache.camel.component.as2.api.CanonicalOutputStream;
@@ -183,7 +183,7 @@ public class AS2MessageDispositionNotificationEntity extends MimeEntity {
@Override
public void writeTo(OutputStream outstream) throws IOException {
NoCloseOutputStream ncos = new NoCloseOutputStream(outstream);
- try (CanonicalOutputStream canonicalOutstream = new CanonicalOutputStream(ncos, AS2Charset.US_ASCII)) {
+ try (CanonicalOutputStream canonicalOutstream = new CanonicalOutputStream(ncos, StandardCharsets.US_ASCII.name())) {
// Write out mime part headers if this is not the main body of
// message.
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationEDIEntity.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationEDIEntity.java
index 8a1ee1e5734..fe2671933fc 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationEDIEntity.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationEDIEntity.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.as2.api.entity;
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2Header;
import org.apache.camel.component.as2.api.CanonicalOutputStream;
import org.apache.camel.component.as2.api.util.EntityUtils;
@@ -55,7 +55,7 @@ public abstract class ApplicationEDIEntity extends MimeEntity {
@Override
public void writeTo(OutputStream outstream) throws IOException {
NoCloseOutputStream ncos = new NoCloseOutputStream(outstream);
- try (CanonicalOutputStream canonicalOutstream = new CanonicalOutputStream(ncos, AS2Charset.US_ASCII);
+ try (CanonicalOutputStream canonicalOutstream = new CanonicalOutputStream(ncos, StandardCharsets.US_ASCII.name());
OutputStream transferEncodedStream = EntityUtils.encode(canonicalOutstream, getContentTransferEncodingValue())) {
// Write out mime part headers if this is not the main body of message.
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeCompressedDataEntity.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeCompressedDataEntity.java
index 7f23ff03fab..1f05f56218f 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeCompressedDataEntity.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeCompressedDataEntity.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.as2.api.entity;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2Header;
import org.apache.camel.component.as2.api.CanonicalOutputStream;
import org.apache.camel.component.as2.api.util.EntityUtils;
@@ -79,7 +79,7 @@ public class ApplicationPkcs7MimeCompressedDataEntity extends MimeEntity {
// Write out mime part headers if this is not the main body of message.
if (!isMainBody()) {
- try (CanonicalOutputStream canonicalOutstream = new CanonicalOutputStream(ncos, AS2Charset.US_ASCII)) {
+ try (CanonicalOutputStream canonicalOutstream = new CanonicalOutputStream(ncos, StandardCharsets.US_ASCII.name())) {
HeaderIterator it = headerIterator();
while (it.hasNext()) {
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEnvelopedDataEntity.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEnvelopedDataEntity.java
index b76b7b01da9..21b53c7a89e 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEnvelopedDataEntity.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7MimeEnvelopedDataEntity.java
@@ -19,9 +19,9 @@ package org.apache.camel.component.as2.api.entity;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2Header;
import org.apache.camel.component.as2.api.CanonicalOutputStream;
import org.apache.camel.component.as2.api.util.EntityUtils;
@@ -79,7 +79,7 @@ public class ApplicationPkcs7MimeEnvelopedDataEntity extends MimeEntity {
// Write out mime part headers if this is not the main body of message.
if (!isMainBody()) {
- try (CanonicalOutputStream canonicalOutstream = new CanonicalOutputStream(ncos, AS2Charset.US_ASCII)) {
+ try (CanonicalOutputStream canonicalOutstream = new CanonicalOutputStream(ncos, StandardCharsets.US_ASCII.name())) {
HeaderIterator it = headerIterator();
while (it.hasNext()) {
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7SignatureEntity.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7SignatureEntity.java
index 9047239554f..35e52fe6b95 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7SignatureEntity.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/ApplicationPkcs7SignatureEntity.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.as2.api.entity;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2Header;
import org.apache.camel.component.as2.api.AS2MediaType;
import org.apache.camel.component.as2.api.CanonicalOutputStream;
@@ -88,7 +88,7 @@ public class ApplicationPkcs7SignatureEntity extends MimeEntity {
// Write out mime part headers if this is not the main body of message.
if (!isMainBody()) {
- try (CanonicalOutputStream canonicalOutstream = new CanonicalOutputStream(ncos, AS2Charset.US_ASCII)) {
+ try (CanonicalOutputStream canonicalOutstream = new CanonicalOutputStream(ncos, StandardCharsets.US_ASCII.name())) {
HeaderIterator it = headerIterator();
while (it.hasNext()) {
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/DispositionNotificationMultipartReportEntity.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/DispositionNotificationMultipartReportEntity.java
index f6ddce03ee1..fbfe1e64e8c 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/DispositionNotificationMultipartReportEntity.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/DispositionNotificationMultipartReportEntity.java
@@ -16,10 +16,10 @@
*/
package org.apache.camel.component.as2.api.entity;
+import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.util.Map;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2Header;
import org.apache.camel.component.as2.api.AS2MimeType;
import org.apache.camel.component.as2.api.AS2TransferEncoding;
@@ -72,7 +72,7 @@ public class DispositionNotificationMultipartReportEntity extends MultipartRepor
}
protected TextPlainEntity buildPlainTextReport(String mdnMessage) {
- return new TextPlainEntity(mdnMessage, AS2Charset.US_ASCII, AS2TransferEncoding.SEVENBIT, false);
+ return new TextPlainEntity(mdnMessage, StandardCharsets.US_ASCII.name(), AS2TransferEncoding.SEVENBIT, false);
}
protected String getContentTypeValue(String boundary) {
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java
index 273e0c8e340..79f466d3402 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java
@@ -21,6 +21,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
+import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.util.ArrayList;
import java.util.Collection;
@@ -28,7 +29,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Objects;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2Header;
import org.apache.camel.component.as2.api.AS2MimeType;
import org.apache.camel.component.as2.api.io.AS2SessionInputBuffer;
@@ -443,7 +443,7 @@ public final class EntityParser {
ContentType contentType = ContentType.parse(contentTypeStr);
// Determine Charset
- String charsetName = AS2Charset.US_ASCII;
+ String charsetName = StandardCharsets.US_ASCII.name();
Charset charset = contentType.getCharset();
if (charset != null) {
charsetName = charset.name();
@@ -507,7 +507,7 @@ public final class EntityParser {
try {
if (charsetName == null) {
- charsetName = AS2Charset.US_ASCII;
+ charsetName = StandardCharsets.US_ASCII.name();
}
Charset charset = Charset.forName(charsetName);
CharsetDecoder charsetDecoder = charset.newDecoder();
@@ -614,7 +614,7 @@ public final class EntityParser {
try {
if (charsetName == null) {
- charsetName = AS2Charset.US_ASCII;
+ charsetName = StandardCharsets.US_ASCII.name();
}
Charset charset = Charset.forName(charsetName);
CharsetDecoder charsetDecoder = charset.newDecoder();
@@ -655,7 +655,7 @@ public final class EntityParser {
}
String textReportCharsetName = textReportContentType.getCharset() == null
- ? AS2Charset.US_ASCII : textReportContentType.getCharset().name();
+ ? StandardCharsets.US_ASCII.name() : textReportContentType.getCharset().name();
TextPlainEntity textReportEntity
= parseTextPlainEntityBody(inbuffer, boundary, textReportCharsetName, textReportContentTransferEncoding);
textReportEntity.setHeaders(headers);
@@ -693,7 +693,7 @@ public final class EntityParser {
}
String dispositionNotificationCharsetName = dispositionNotificationContentType.getCharset() == null
- ? AS2Charset.US_ASCII : dispositionNotificationContentType.getCharset().name();
+ ? StandardCharsets.US_ASCII.name() : dispositionNotificationContentType.getCharset().name();
AS2MessageDispositionNotificationEntity messageDispositionNotificationEntity
= parseMessageDispositionNotificationEntityBody(
inbuffer, boundary, dispositionNotificationCharsetName,
@@ -727,7 +727,7 @@ public final class EntityParser {
try {
if (charsetName == null) {
- charsetName = AS2Charset.US_ASCII;
+ charsetName = StandardCharsets.US_ASCII.name();
}
Charset charset = Charset.forName(charsetName);
CharsetDecoder charsetDecoder = charset.newDecoder();
@@ -759,7 +759,7 @@ public final class EntityParser {
try {
if (charsetName == null) {
- charsetName = AS2Charset.US_ASCII;
+ charsetName = StandardCharsets.US_ASCII.name();
}
Charset charset = Charset.forName(charsetName);
CharsetDecoder charsetDecoder = charset.newDecoder();
@@ -796,7 +796,7 @@ public final class EntityParser {
try {
Charset charset = entityContentType.getCharset();
if (charset == null) {
- charset = Charset.forName(AS2Charset.US_ASCII);
+ charset = StandardCharsets.US_ASCII;
}
CharsetDecoder charsetDecoder = charset.newDecoder();
@@ -877,7 +877,7 @@ public final class EntityParser {
try {
Charset charset = ediMessageContentType.getCharset();
if (charset == null) {
- charset = Charset.forName(AS2Charset.US_ASCII);
+ charset = StandardCharsets.US_ASCII;
}
CharsetDecoder charsetDecoder = charset.newDecoder();
@@ -912,7 +912,7 @@ public final class EntityParser {
try {
Charset charset = contentType.getCharset();
if (charset == null) {
- charset = Charset.forName(AS2Charset.US_ASCII);
+ charset = StandardCharsets.US_ASCII;
}
CharsetDecoder charsetDecoder = charset.newDecoder();
@@ -947,7 +947,7 @@ public final class EntityParser {
try {
Charset charset = contentType.getCharset();
if (charset == null) {
- charset = Charset.forName(AS2Charset.US_ASCII);
+ charset = StandardCharsets.US_ASCII;
}
CharsetDecoder charsetDecoder = charset.newDecoder();
@@ -981,7 +981,7 @@ public final class EntityParser {
try {
Charset charset = contentType.getCharset();
if (charset == null) {
- charset = Charset.forName(AS2Charset.US_ASCII);
+ charset = StandardCharsets.US_ASCII;
}
CharsetDecoder charsetDecoder = charset.newDecoder();
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/MimeEntity.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/MimeEntity.java
index e5d60f55b79..ef2732e98d1 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/MimeEntity.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/MimeEntity.java
@@ -23,8 +23,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2Header;
import org.apache.http.Header;
import org.apache.http.HeaderIterator;
@@ -270,14 +270,14 @@ public abstract class MimeEntity extends AbstractHttpEntity {
public String getCharset() {
if (getContentType() == null) {
- return AS2Charset.US_ASCII;
+ return StandardCharsets.US_ASCII.name();
}
ContentType contentType = ContentType.parse(getContentType().getValue());
Charset charset = contentType.getCharset();
if (charset != null) {
return charset.name();
}
- return AS2Charset.US_ASCII;
+ return StandardCharsets.US_ASCII.name();
}
}
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/TextPlainEntity.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/TextPlainEntity.java
index 0a9e38b3192..a84146cda7b 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/TextPlainEntity.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/TextPlainEntity.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.as2.api.entity;
import java.io.IOException;
import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2MediaType;
import org.apache.camel.component.as2.api.CanonicalOutputStream;
import org.apache.http.Header;
@@ -45,7 +45,7 @@ public class TextPlainEntity extends MimeEntity {
@Override
public void writeTo(OutputStream outstream) throws IOException {
NoCloseOutputStream ncos = new NoCloseOutputStream(outstream);
- try (CanonicalOutputStream canonicalOutstream = new CanonicalOutputStream(ncos, AS2Charset.US_ASCII)) {
+ try (CanonicalOutputStream canonicalOutstream = new CanonicalOutputStream(ncos, StandardCharsets.US_ASCII.name())) {
// Write out mime part headers if this is not the main body of message.
if (!isMainBody()) {
@@ -58,7 +58,7 @@ public class TextPlainEntity extends MimeEntity {
}
// Write out content
- canonicalOutstream.write(content.getBytes(AS2Charset.US_ASCII), 0, content.length());
+ canonicalOutstream.write(content.getBytes(StandardCharsets.US_ASCII), 0, content.length());
}
}
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/protocol/ResponseMDN.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/protocol/ResponseMDN.java
index ad8ec315990..ba526ed7c11 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/protocol/ResponseMDN.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/protocol/ResponseMDN.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.as2.api.protocol;
import java.io.IOException;
import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.security.cert.Certificate;
import java.util.HashMap;
@@ -25,7 +26,6 @@ import java.util.Map;
import java.util.Properties;
import org.apache.camel.component.as2.api.AS2AsynchronousMDNManager;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2Constants;
import org.apache.camel.component.as2.api.AS2Header;
import org.apache.camel.component.as2.api.AS2ServerManager;
@@ -144,7 +144,7 @@ public class ResponseMDN implements HttpResponseInterceptor {
AS2DispositionType.FAILED, null, null, null, null, null, mdnMessageTemplate);
multipartReportEntity = new DispositionNotificationMultipartReportEntity(
httpEntityEnclosingRequest, response, DispositionMode.AUTOMATIC_ACTION_MDN_SENT_AUTOMATICALLY,
- AS2DispositionType.FAILED, null, null, null, null, null, AS2Charset.US_ASCII, boundary, true,
+ AS2DispositionType.FAILED, null, null, null, null, null, StandardCharsets.US_ASCII.name(), boundary, true,
decryptingPrivateKey, mdnMessage);
} else {
String mdnMessage = createMdnDescription(httpEntityEnclosingRequest, response,
@@ -153,7 +153,7 @@ public class ResponseMDN implements HttpResponseInterceptor {
mdnMessageTemplate);
multipartReportEntity = new DispositionNotificationMultipartReportEntity(
httpEntityEnclosingRequest, response, DispositionMode.AUTOMATIC_ACTION_MDN_SENT_AUTOMATICALLY,
- AS2DispositionType.PROCESSED, null, null, null, null, null, AS2Charset.US_ASCII, boundary, true,
+ AS2DispositionType.PROCESSED, null, null, null, null, null, StandardCharsets.US_ASCII.name(), boundary, true,
decryptingPrivateKey, mdnMessage);
}
@@ -229,7 +229,7 @@ public class ResponseMDN implements HttpResponseInterceptor {
multipartReportEntity.setMainBody(false);
MultipartSignedEntity multipartSignedEntity = new MultipartSignedEntity(
multipartReportEntity, gen,
- AS2Charset.US_ASCII, AS2TransferEncoding.BASE64, false, null);
+ StandardCharsets.US_ASCII.name(), AS2TransferEncoding.BASE64, false, null);
response.setHeader(multipartSignedEntity.getContentType());
EntityUtils.setMessageEntity(response, multipartSignedEntity);
} catch (Exception e) {
diff --git a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/util/MicUtils.java b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/util/MicUtils.java
index f55da876246..af84d5da6ad 100644
--- a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/util/MicUtils.java
+++ b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/util/MicUtils.java
@@ -16,12 +16,12 @@
*/
package org.apache.camel.component.as2.api.util;
+import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2Header;
import org.apache.camel.component.as2.api.AS2MicAlgorithm;
import org.apache.camel.component.as2.api.entity.DispositionNotificationOptions;
@@ -45,7 +45,7 @@ public final class MicUtils {
public ReceivedContentMic(String digestAlgorithmId, byte[] messageDigest) throws Exception {
this.digestAlgorithmId = digestAlgorithmId;
messageDigest = EntityUtils.encode(messageDigest, "base64");
- this.encodedMessageDigest = new String(messageDigest, AS2Charset.US_ASCII);
+ this.encodedMessageDigest = new String(messageDigest, StandardCharsets.US_ASCII);
}
// Used when parsing received content MIC from received string
diff --git a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
index 402e2463603..696c151d28f 100644
--- a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
+++ b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/AS2MessageTest.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.as2.api;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.SecureRandom;
@@ -247,7 +248,7 @@ public class AS2MessageTest {
AS2ClientManager clientManager = new AS2ClientManager(clientConnection);
HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
- AS2MessageStructure.PLAIN, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII),
+ AS2MessageStructure.PLAIN, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII),
null, null, null, null, null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null,
"file.txt");
@@ -289,7 +290,7 @@ public class AS2MessageTest {
AS2ClientManager clientManager = new AS2ClientManager(clientConnection);
HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
- AS2MessageStructure.SIGNED, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII),
+ AS2MessageStructure.SIGNED, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII),
null, AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(),
null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, "file.txt");
@@ -446,7 +447,7 @@ public class AS2MessageTest {
HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
AS2MessageStructure.ENCRYPTED,
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null,
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII), null,
AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(), null,
DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, encryptionAlgorithm,
certList.toArray(new Certificate[0]), "file.txt");
@@ -504,7 +505,7 @@ public class AS2MessageTest {
HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
AS2MessageStructure.SIGNED_ENCRYPTED,
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null,
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII), null,
AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(), null,
DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, encryptionAlgorithm,
certList.toArray(new Certificate[0]), "file.txt");
@@ -571,7 +572,7 @@ public class AS2MessageTest {
AS2ClientManager clientManager = new AS2ClientManager(clientConnection);
HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
- AS2MessageStructure.SIGNED, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII),
+ AS2MessageStructure.SIGNED, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII),
null, AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(),
null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, "file.txt");
@@ -601,7 +602,7 @@ public class AS2MessageTest {
AS2ClientManager clientManager = new AS2ClientManager(clientConnection);
HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
- AS2MessageStructure.PLAIN, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII),
+ AS2MessageStructure.PLAIN, ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII),
null, null, null, null, null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null,
"file.txt");
@@ -622,11 +623,11 @@ public class AS2MessageTest {
= (DispositionNotificationMultipartReportEntity) responseSignedDataEntity;
assertEquals(2, reportEntity.getPartCount(), "Unexpected number of body parts in report");
MimeEntity firstPart = reportEntity.getPart(0);
- assertEquals(ContentType.create(AS2MimeType.TEXT_PLAIN, AS2Charset.US_ASCII).toString(),
+ assertEquals(ContentType.create(AS2MimeType.TEXT_PLAIN, StandardCharsets.US_ASCII).toString(),
firstPart.getContentTypeValue(),
"Unexpected content type in first body part of report");
MimeEntity secondPart = reportEntity.getPart(1);
- assertEquals(ContentType.create(AS2MimeType.MESSAGE_DISPOSITION_NOTIFICATION, AS2Charset.US_ASCII).toString(),
+ assertEquals(ContentType.create(AS2MimeType.MESSAGE_DISPOSITION_NOTIFICATION, StandardCharsets.US_ASCII).toString(),
secondPart.getContentTypeValue(),
"Unexpected content type in second body part of report");
ApplicationPkcs7SignatureEntity signatureEntity = responseSignedEntity.getSignatureEntity();
@@ -645,7 +646,7 @@ public class AS2MessageTest {
// Create plain edi request message to acknowledge
ApplicationEDIEntity ediEntity = EntityUtils.createEDIEntity(EDI_MESSAGE,
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null, false, "filename.txt");
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII), null, false, "filename.txt");
HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", REQUEST_URI);
HttpMessageUtils.setHeaderValue(request, AS2Header.SUBJECT, SUBJECT);
String httpdate = DATE_GENERATOR.getCurrentDate();
@@ -718,7 +719,7 @@ public class AS2MessageTest {
HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
AS2MessageStructure.PLAIN_COMPRESSED,
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null,
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII), null,
null, null, null, AS2CompressionAlgorithm.ZLIB,
DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null,
null, "file.txt");
@@ -771,7 +772,7 @@ public class AS2MessageTest {
HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
AS2MessageStructure.SIGNED_COMPRESSED,
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), "base64",
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII), "base64",
AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(),
AS2CompressionAlgorithm.ZLIB,
DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null,
@@ -840,7 +841,7 @@ public class AS2MessageTest {
HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
AS2MessageStructure.ENCRYPTED_COMPRESSED,
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), "base64", null, null, null,
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII), "base64", null, null, null,
AS2CompressionAlgorithm.ZLIB, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS,
AS2EncryptionAlgorithm.AES128_CBC, certList.toArray(new Certificate[0]), "file.txt");
@@ -902,7 +903,7 @@ public class AS2MessageTest {
HttpCoreContext httpContext = clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME,
AS2MessageStructure.ENCRYPTED_COMPRESSED_SIGNED,
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null,
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII), null,
AS2SignatureAlgorithm.SHA256WITHRSA, certList.toArray(new Certificate[0]), signingKP.getPrivate(),
AS2CompressionAlgorithm.ZLIB, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS,
AS2EncryptionAlgorithm.AES128_CBC, certList.toArray(new Certificate[0]), "file.txt");
diff --git a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/util/EntityUtilsTest.java b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/util/EntityUtilsTest.java
index 360415c97c6..63ec1b2afed 100644
--- a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/util/EntityUtilsTest.java
+++ b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/util/EntityUtilsTest.java
@@ -16,7 +16,8 @@
*/
package org.apache.camel.component.as2.api.util;
-import org.apache.camel.component.as2.api.AS2Charset;
+import java.nio.charset.StandardCharsets;
+
import org.apache.camel.component.as2.api.AS2Header;
import org.apache.camel.component.as2.api.AS2MediaType;
import org.apache.camel.component.as2.api.entity.ApplicationEDIEntity;
@@ -43,7 +44,7 @@ public class EntityUtilsTest {
@Test
public void testCreateEDIEntityContentTypeWithEncoding() throws Exception {
- ContentType ediMessageContentType = ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII);
+ ContentType ediMessageContentType = ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII);
String ediMessage = "whatever";
ApplicationEDIEntity applicationEDIEntity
= EntityUtils.createEDIEntity(ediMessage, ediMessageContentType, null, false, "sample.txt");
diff --git a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/util/MicUtilsTest.java b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/util/MicUtilsTest.java
index e28c85f7141..84629b94893 100644
--- a/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/util/MicUtilsTest.java
+++ b/components/camel-as2/camel-as2-api/src/test/java/org/apache/camel/component/as2/api/util/MicUtilsTest.java
@@ -17,9 +17,9 @@
package org.apache.camel.component.as2.api.util;
import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
import java.security.Security;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2Header;
import org.apache.camel.component.as2.api.AS2MimeType;
import org.apache.camel.component.as2.api.AS2TransferEncoding;
@@ -94,7 +94,7 @@ public class MicUtilsTest {
ApplicationEDIFACTEntity edifactEntity
= new ApplicationEDIFACTEntity(
- EDI_MESSAGE, AS2Charset.US_ASCII, AS2TransferEncoding.NONE, true, "filename.txt");
+ EDI_MESSAGE, StandardCharsets.US_ASCII.name(), AS2TransferEncoding.NONE, true, "filename.txt");
InputStream is = edifactEntity.getContent();
BasicHttpEntity basicEntity = new BasicHttpEntity();
basicEntity.setContent(is);
diff --git a/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ClientManagerIT.java b/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ClientManagerIT.java
index 57941b7e502..a58d8c3159f 100644
--- a/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ClientManagerIT.java
+++ b/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ClientManagerIT.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.as2;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.SecureRandom;
@@ -32,7 +33,6 @@ import org.apache.camel.CamelException;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.as2.api.AS2AsynchronousMDNManager;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2CompressionAlgorithm;
import org.apache.camel.component.as2.api.AS2Constants;
import org.apache.camel.component.as2.api.AS2EncryptionAlgorithm;
@@ -239,7 +239,7 @@ public class AS2ClientManagerIT extends AbstractAS2ITSupport {
headers.put("CamelAS2.as2MessageStructure", AS2MessageStructure.PLAIN);
// parameter type is org.apache.http.entity.ContentType
headers.put("CamelAS2.ediMessageContentType",
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII));
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII.name()));
// parameter type is String
headers.put("CamelAS2.ediMessageTransferEncoding", EDI_MESSAGE_CONTENT_TRANSFER_ENCODING);
// parameter type is String
@@ -282,10 +282,10 @@ public class AS2ClientManagerIT extends AbstractAS2ITSupport {
= (DispositionNotificationMultipartReportEntity) responseEntity;
assertEquals(2, reportEntity.getPartCount(), "Unexpected number of body parts in report");
MimeEntity firstPart = reportEntity.getPart(0);
- assertEquals(ContentType.create(AS2MimeType.TEXT_PLAIN, AS2Charset.US_ASCII).toString(),
+ assertEquals(ContentType.create(AS2MimeType.TEXT_PLAIN, StandardCharsets.US_ASCII).toString(),
firstPart.getContentTypeValue(), "Unexpected content type in first body part of report");
MimeEntity secondPart = reportEntity.getPart(1);
- assertEquals(ContentType.create(AS2MimeType.MESSAGE_DISPOSITION_NOTIFICATION, AS2Charset.US_ASCII).toString(),
+ assertEquals(ContentType.create(AS2MimeType.MESSAGE_DISPOSITION_NOTIFICATION, StandardCharsets.US_ASCII).toString(),
secondPart.getContentTypeValue(),
"Unexpected content type in second body part of report");
@@ -318,7 +318,7 @@ public class AS2ClientManagerIT extends AbstractAS2ITSupport {
headers.put("CamelAS2.as2MessageStructure", AS2MessageStructure.PLAIN);
// parameter type is org.apache.http.entity.ContentType
headers.put("CamelAS2.ediMessageContentType",
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII));
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII));
// parameter type is String
headers.put("CamelAS2.ediMessageTransferEncoding", EDI_MESSAGE_CONTENT_TRANSFER_ENCODING);
// parameter type is String
@@ -361,10 +361,10 @@ public class AS2ClientManagerIT extends AbstractAS2ITSupport {
= (DispositionNotificationMultipartReportEntity) responseEntity;
assertEquals(2, reportEntity.getPartCount(), "Unexpected number of body parts in report");
MimeEntity firstPart = reportEntity.getPart(0);
- assertEquals(ContentType.create(AS2MimeType.TEXT_PLAIN, AS2Charset.US_ASCII).toString(),
+ assertEquals(ContentType.create(AS2MimeType.TEXT_PLAIN, StandardCharsets.US_ASCII).toString(),
firstPart.getContentTypeValue(), "Unexpected content type in first body part of report");
MimeEntity secondPart = reportEntity.getPart(1);
- assertEquals(ContentType.create(AS2MimeType.MESSAGE_DISPOSITION_NOTIFICATION, AS2Charset.US_ASCII).toString(),
+ assertEquals(ContentType.create(AS2MimeType.MESSAGE_DISPOSITION_NOTIFICATION, StandardCharsets.US_ASCII).toString(),
secondPart.getContentTypeValue(),
"Unexpected content type in second body part of report");
@@ -401,7 +401,7 @@ public class AS2ClientManagerIT extends AbstractAS2ITSupport {
headers.put("CamelAS2.as2MessageStructure", AS2MessageStructure.ENCRYPTED);
// parameter type is org.apache.http.entity.ContentType
headers.put("CamelAS2.ediMessageContentType",
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII));
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII));
// parameter type is String
headers.put("CamelAS2.ediMessageTransferEncoding", EDI_MESSAGE_CONTENT_TRANSFER_ENCODING);
// parameter type is String
@@ -453,10 +453,10 @@ public class AS2ClientManagerIT extends AbstractAS2ITSupport {
= (DispositionNotificationMultipartReportEntity) responseEntity;
assertEquals(2, reportEntity.getPartCount(), "Unexpected number of body parts in report");
MimeEntity firstPart = reportEntity.getPart(0);
- assertEquals(ContentType.create(AS2MimeType.TEXT_PLAIN, AS2Charset.US_ASCII).toString(),
+ assertEquals(ContentType.create(AS2MimeType.TEXT_PLAIN, StandardCharsets.US_ASCII).toString(),
firstPart.getContentTypeValue(), "Unexpected content type in first body part of report");
MimeEntity secondPart = reportEntity.getPart(1);
- assertEquals(ContentType.create(AS2MimeType.MESSAGE_DISPOSITION_NOTIFICATION, AS2Charset.US_ASCII).toString(),
+ assertEquals(ContentType.create(AS2MimeType.MESSAGE_DISPOSITION_NOTIFICATION, StandardCharsets.US_ASCII).toString(),
secondPart.getContentTypeValue(),
"Unexpected content type in second body part of report");
@@ -493,7 +493,7 @@ public class AS2ClientManagerIT extends AbstractAS2ITSupport {
headers.put("CamelAS2.as2MessageStructure", AS2MessageStructure.SIGNED);
// parameter type is org.apache.http.entity.ContentType
headers.put("CamelAS2.ediMessageContentType",
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII));
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII));
// parameter type is String
headers.put("CamelAS2.ediMessageTransferEncoding", EDI_MESSAGE_CONTENT_TRANSFER_ENCODING);
// parameter type is org.apache.camel.component.as2.api.AS2SignatureAlgorithm
@@ -554,10 +554,10 @@ public class AS2ClientManagerIT extends AbstractAS2ITSupport {
= (DispositionNotificationMultipartReportEntity) responseSignedDataEntity;
assertEquals(2, reportEntity.getPartCount(), "Unexpected number of body parts in report");
MimeEntity firstPart = reportEntity.getPart(0);
- assertEquals(ContentType.create(AS2MimeType.TEXT_PLAIN, AS2Charset.US_ASCII).toString(),
+ assertEquals(ContentType.create(AS2MimeType.TEXT_PLAIN, StandardCharsets.US_ASCII).toString(),
firstPart.getContentTypeValue(), "Unexpected content type in first body part of report");
MimeEntity secondPart = reportEntity.getPart(1);
- assertEquals(ContentType.create(AS2MimeType.MESSAGE_DISPOSITION_NOTIFICATION, AS2Charset.US_ASCII).toString(),
+ assertEquals(ContentType.create(AS2MimeType.MESSAGE_DISPOSITION_NOTIFICATION, StandardCharsets.US_ASCII).toString(),
secondPart.getContentTypeValue(),
"Unexpected content type in second body part of report");
ApplicationPkcs7SignatureEntity signatureEntity = responseSignedEntity.getSignatureEntity();
@@ -601,7 +601,7 @@ public class AS2ClientManagerIT extends AbstractAS2ITSupport {
headers.put("CamelAS2.as2MessageStructure", AS2MessageStructure.PLAIN_COMPRESSED);
// parameter type is org.apache.http.entity.ContentType
headers.put("CamelAS2.ediMessageContentType",
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII));
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII));
// parameter type is String
headers.put("CamelAS2.ediMessageTransferEncoding", EDI_MESSAGE_CONTENT_TRANSFER_ENCODING);
// parameter type is org.apache.camel.component.as2.api.AS2CompressionAlgorithm
@@ -659,10 +659,10 @@ public class AS2ClientManagerIT extends AbstractAS2ITSupport {
= (DispositionNotificationMultipartReportEntity) responseSignedDataEntity;
assertEquals(2, reportEntity.getPartCount(), "Unexpected number of body parts in report");
MimeEntity firstPart = reportEntity.getPart(0);
- assertEquals(ContentType.create(AS2MimeType.TEXT_PLAIN, AS2Charset.US_ASCII).toString(),
+ assertEquals(ContentType.create(AS2MimeType.TEXT_PLAIN, StandardCharsets.US_ASCII).toString(),
firstPart.getContentTypeValue(), "Unexpected content type in first body part of report");
MimeEntity secondPart = reportEntity.getPart(1);
- assertEquals(ContentType.create(AS2MimeType.MESSAGE_DISPOSITION_NOTIFICATION, AS2Charset.US_ASCII).toString(),
+ assertEquals(ContentType.create(AS2MimeType.MESSAGE_DISPOSITION_NOTIFICATION, StandardCharsets.US_ASCII).toString(),
secondPart.getContentTypeValue(),
"Unexpected content type in second body part of report");
ApplicationPkcs7SignatureEntity signatureEntity = responseSignedEntity.getSignatureEntity();
@@ -702,7 +702,7 @@ public class AS2ClientManagerIT extends AbstractAS2ITSupport {
// Create plain edi request message to acknowledge
ApplicationEDIEntity ediEntity = EntityUtils.createEDIEntity(EDI_MESSAGE,
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null, false, ATTACHED_FILE_NAME);
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII), null, false, ATTACHED_FILE_NAME);
HttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", REQUEST_URI);
HttpMessageUtils.setHeaderValue(request, AS2Header.SUBJECT, SUBJECT);
String httpdate = DATE_GENERATOR.getCurrentDate();
diff --git a/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ServerManagerIT.java b/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ServerManagerIT.java
index b3721014b91..4982e7b0854 100644
--- a/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ServerManagerIT.java
+++ b/components/camel-as2/camel-as2-component/src/test/java/org/apache/camel/component/as2/AS2ServerManagerIT.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.component.as2;
+import java.nio.charset.StandardCharsets;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.SecureRandom;
@@ -31,7 +32,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.as2.api.AS2Charset;
import org.apache.camel.component.as2.api.AS2ClientConnection;
import org.apache.camel.component.as2.api.AS2ClientManager;
import org.apache.camel.component.as2.api.AS2EncryptionAlgorithm;
@@ -153,7 +153,7 @@ public class AS2ServerManagerIT extends AbstractAS2ITSupport {
AS2ClientManager clientManager = new AS2ClientManager(clientConnection);
clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME, AS2MessageStructure.PLAIN,
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null, null, null, null,
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII), null, null, null, null,
null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
MockEndpoint mockEndpoint = getMockEndpoint("mock:as2RcvMsgs");
@@ -216,7 +216,7 @@ public class AS2ServerManagerIT extends AbstractAS2ITSupport {
AS2ClientManager clientManager = new AS2ClientManager(clientConnection);
clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME, AS2MessageStructure.SIGNED,
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null,
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII), null,
AS2SignatureAlgorithm.SHA256WITHRSA,
certList.toArray(new Certificate[0]), signingKP.getPrivate(), null, DISPOSITION_NOTIFICATION_TO,
SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
@@ -294,7 +294,7 @@ public class AS2ServerManagerIT extends AbstractAS2ITSupport {
AS2ClientManager clientManager = new AS2ClientManager(clientConnection);
clientManager.send(EDI_MESSAGE, REQUEST_URI, SUBJECT, FROM, AS2_NAME, AS2_NAME, AS2MessageStructure.ENCRYPTED,
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null, null, null, null,
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII), null, null, null, null,
null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, AS2EncryptionAlgorithm.AES128_CBC,
certList.toArray(new Certificate[0]), null);
@@ -363,7 +363,7 @@ public class AS2ServerManagerIT extends AbstractAS2ITSupport {
HttpCoreContext context = clientManager.send(EDI_MESSAGE, "/process_error", SUBJECT, FROM, AS2_NAME, AS2_NAME,
AS2MessageStructure.PLAIN,
- ContentType.create(AS2MediaType.APPLICATION_EDIFACT, AS2Charset.US_ASCII), null, null, null, null,
+ ContentType.create(AS2MediaType.APPLICATION_EDIFACT, StandardCharsets.US_ASCII), null, null, null, null,
null, DISPOSITION_NOTIFICATION_TO, SIGNED_RECEIPT_MIC_ALGORITHMS, null, null, null);
MockEndpoint mockEndpoint = getMockEndpoint("mock:as2RcvMsgs");