This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit e837471c745483b707b3bf1b7fb54063edb1d47f Author: Benoit Tellier <btell...@linagora.com> AuthorDate: Mon Jun 1 12:03:54 2020 +0700 JAMES−3182 JMAPResponse: fail early upon unspecified responseName/methodCallId Currently we build an invalid object we cannot write to the client: ``` 12:00:11.515 [ERROR] o.a.j.j.h.JMAPApiRoutes - Unexpected error java.lang.NullPointerException: methodCallId is mandatory at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:895) at org.apache.james.jmap.draft.model.InvocationResponse.<init>(InvocationResponse.java:35) at org.apache.james.jmap.draft.methods.JmapResponseWriterImpl.lambda$formatMethodResponse$0(JmapResponseWriterImpl.java:58) ``` --- .../main/java/org/apache/james/jmap/draft/methods/JmapResponse.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/JmapResponse.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/JmapResponse.java index 8113098..2706e25 100644 --- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/JmapResponse.java +++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/JmapResponse.java @@ -28,6 +28,7 @@ import org.apache.james.jmap.draft.model.Property; import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import com.google.common.base.MoreObjects; import com.google.common.base.Objects; +import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; public class JmapResponse { @@ -90,6 +91,9 @@ public class JmapResponse { public JmapResponse build() { + Preconditions.checkState(methodCallId != null, "'methodCallId' needs to be specified"); + Preconditions.checkState(responseName != null, "'responseName' needs to be specified"); + return new JmapResponse(responseName, methodCallId, response, properties, filterProvider); } } --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org