This is an automated email from the ASF dual-hosted git repository. rcordier 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 4942ad704c [FIX] Prevent NPE when fetching the raw property of a Field 4942ad704c is described below commit 4942ad704cd0ba7e87cb15b19277747a17195ee3 Author: Rene Cordier <rcord...@linagora.com> AuthorDate: Wed Aug 27 09:27:55 2025 +0700 [FIX] Prevent NPE when fetching the raw property of a Field --- .../main/scala/org/apache/james/jmap/mail/EmailHeader.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/EmailHeader.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/EmailHeader.scala index 6256d7c283..90a3482eaf 100644 --- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/EmailHeader.scala +++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/EmailHeader.scala @@ -39,7 +39,15 @@ object EmailHeader { } object RawHeaderValue { - def from(field: Field): RawHeaderValue = RawHeaderValue(new String(field.getRaw.toByteArray, US_ASCII).substring(field.getName.length + 1)) + def from(field: Field): RawHeaderValue = { + val rawValue: String = + Option(field.getRaw) + .map(raw => new String(raw.toByteArray, US_ASCII)) + .map(_.substring(field.getName.length + 1)) + .getOrElse(field.getBody) + + RawHeaderValue(rawValue) + } } object TextHeaderValue { --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org