Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit86d5395

Browse files
committed
fix(components): As2 note on stream closure design
1 parent6a49026 commit86d5395

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

‎components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2AsyncMDNServerConnection.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ public RequestHandlerThread(HttpService httpService, Socket inSocket) throws IOE
150150
}
151151
Http1Configcfg =Http1Config.custom().setBufferSize(DEFAULT_BUFFER_SIZE).build();
152152
// parses the received AS2MessageEntity
153-
AS2BHttpServerConnectioninConn =newAS2BHttpServerConnection(cfg);
153+
// NOTE: the connection will be closed after the execution of the process.
154+
AS2BHttpServerConnectioninConn =newAS2BHttpServerConnection(cfg);// NOSONAR
154155
inConn.bind(inSocket);
155156
// TODO Update once baseline is Java 21
156157
// setName(REQUEST_HANDLER_THREAD_NAME_PREFIX + threadId());
@@ -175,6 +176,7 @@ public void run() {
175176
this.serverConnection.close();
176177
}catch (finalIOExceptione) {
177178
// ignore
179+
LOG.warn("An exception happened while closing server connection: ignoring",e);
178180
}
179181
}
180182
}

‎components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/entity/EntityParser.java‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ private static void parseByMimeType(
527527
}
528528
}
529529

530+
// MultipartSignedEntity returned must be closed by the client after using it.
530531
publicstaticMultipartSignedEntityparseMultipartSignedEntityBody(
531532
AS2SessionInputBufferinbuffer,
532533
InputStreamis,
@@ -552,8 +553,10 @@ public static MultipartSignedEntity parseMultipartSignedEntityBody(
552553
newBasicNameValuePair("boundary",boundary),newBasicNameValuePair("micalg",micalg),
553554
newBasicNameValuePair("charset",charsetName) };
554555
ContentTypecontentType =ContentType.create(AS2MimeType.MULTIPART_SIGNED,parameters);
556+
// NOTE: this object is returned by the factory method.
557+
// Client must make sure to close it.
555558
MultipartSignedEntitymultipartSignedEntity
556-
=newMultipartSignedEntity(contentType,contentTransferEncoding,boundary,false);
559+
=newMultipartSignedEntity(contentType,contentTransferEncoding,boundary,false);// NOSONAR
557560

558561
// Skip Preamble and Start Boundary line
559562
skipPreambleAndStartBoundary(inbuffer,is,boundary);
@@ -635,6 +638,7 @@ public static MultipartSignedEntity parseMultipartSignedEntityBody(
635638
}
636639
}
637640

641+
// DispositionNotificationMultipartReportEntity must be closed by the client after using it.
638642
publicstaticDispositionNotificationMultipartReportEntityparseMultipartReportEntityBody(
639643
AS2SessionInputBufferinbuffer,
640644
InputStreamis,
@@ -654,8 +658,9 @@ public static DispositionNotificationMultipartReportEntity parseMultipartReportE
654658

655659
inbuffer.setCharsetDecoder(charsetDecoder);
656660

661+
// NOTE: the client must close the resource created by this factory method.
657662
DispositionNotificationMultipartReportEntitydispositionNotificationMultipartReportEntity
658-
=newDispositionNotificationMultipartReportEntity(boundary,contentTransferEncoding,false);
663+
=newDispositionNotificationMultipartReportEntity(boundary,contentTransferEncoding,false);// NOSONAR
659664

660665
// Skip Preamble and Start Boundary line
661666
skipPreambleAndStartBoundary(inbuffer,is,boundary);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp