You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2020/06/04 02:18:03 UTC
[james-project] 04/07: JAMES−3182 JMAPResponse: fail early upon unspecified responseName/methodCallId
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 <bt...@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-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org