This is an automated email from the ASF dual-hosted git repository.
quantranhong1999 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push:
new 8a9f1b4084 [FIX] JMAP DownloadRoutes: avoid noisy benign
IllegalStateException upon mid-stream errors
8a9f1b4084 is described below
commit 8a9f1b40843c03b3340975155c33186c729fe0b2
Author: Benoit TELLIER <[email protected]>
AuthorDate: Wed Jul 8 17:13:02 2026 +0200
[FIX] JMAP DownloadRoutes: avoid noisy benign IllegalStateException upon
mid-stream errors
---
.../apache/james/jmap/routes/DownloadRoutes.scala | 23 +++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/DownloadRoutes.scala
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/DownloadRoutes.scala
index a91155f186..942accf14a 100644
---
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/DownloadRoutes.scala
+++
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/routes/DownloadRoutes.scala
@@ -440,13 +440,18 @@ class DownloadRoutes
@Inject()(@Named(InjectionKeys.RFC_8621) val authenticator:
.headOption
private def respondDetails(httpServerResponse: HttpServerResponse, details:
ProblemDetails): SMono[Unit] =
- SMono.fromCallable(() => ResponseSerializer.serialize(details))
- .map(Json.stringify)
- .map(_.getBytes(StandardCharsets.UTF_8))
- .flatMap(bytes =>
- SMono.fromPublisher(httpServerResponse.status(details.status)
- .header(CONTENT_TYPE, JSON_CONTENT_TYPE)
- .header(CONTENT_LENGTH, Integer.toString(bytes.length))
- .sendByteArray(SMono.just(bytes))
- .`then`).`then`)
+ if (httpServerResponse.hasSentHeaders) {
+ // Download after sending headers. It is impossible to rewrite the
status (and fails msking the error). Swallow error to avoid log noise.
+ SMono.empty
+ } else {
+ SMono.fromCallable(() => ResponseSerializer.serialize(details))
+ .map(Json.stringify)
+ .map(_.getBytes(StandardCharsets.UTF_8))
+ .flatMap(bytes =>
+ SMono.fromPublisher(httpServerResponse.status(details.status)
+ .header(CONTENT_TYPE, JSON_CONTENT_TYPE)
+ .header(CONTENT_LENGTH, Integer.toString(bytes.length))
+ .sendByteArray(SMono.just(bytes))
+ .`then`).`then`)
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]