james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [10/13] james-project git commit: JAMES-2451 JMAP NotImplemented exception do not report the not implemented method
Date Thu, 05 Jul 2018 02:01:32 GMT
JAMES-2451 JMAP NotImplemented exception do not report the not implemented method


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/b44df191
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/b44df191
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/b44df191

Branch: refs/heads/master
Commit: b44df191d329ce0fe2dd0d1870a213e6cee9ed93
Parents: 8baa752
Author: Gautier DI FOLCO <gdifolco@linagora.com>
Authored: Tue Jul 3 17:39:27 2018 +0200
Committer: benwa <btellier@linagora.com>
Committed: Thu Jul 5 08:59:07 2018 +0700

----------------------------------------------------------------------
 .../integration/GetMailboxesMethodTest.java     |  3 +-
 .../integration/GetVacationResponseTest.java    |  3 +-
 .../integration/SetMailboxesMethodTest.java     |  6 ++-
 .../integration/SetMessagesMethodTest.java      |  6 ++-
 .../integration/SetVacationResponseTest.java    |  3 +-
 .../cucumber/GetMessagesMethodStepdefs.java     | 12 +++++-
 .../test/resources/cucumber/GetMessages.feature |  4 +-
 .../jmap/JmapFieldNotSupportedException.java    | 41 ++++++++++++++++++++
 .../james/jmap/methods/GetMessagesMethod.java   | 11 +++---
 .../james/jmap/methods/RequestHandler.java      | 26 +++++++------
 .../james/jmap/model/GetMailboxesRequest.java   |  5 ++-
 .../james/jmap/model/GetVacationRequest.java    |  5 ++-
 .../james/jmap/model/SetMessagesRequest.java    |  7 ++--
 .../james/jmap/model/SetVacationRequest.java    |  5 ++-
 .../model/mailbox/MailboxCreateRequest.java     |  7 ++--
 15 files changed, 105 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
index 8348fe2..9cbc885 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetMailboxesMethodTest.java
@@ -140,7 +140,8 @@ public abstract class GetMailboxesMethodTest {
         .then()
             .statusCode(200)
             .body(NAME, equalTo("error"))
-            .body(ARGUMENTS + ".type", equalTo("Not yet implemented"));
+            .body(ARGUMENTS + ".type", equalTo("invalidArguments"))
+            .body(ARGUMENTS + ".description", equalTo("The field 'accountId' of 'GetMailboxesRequest'
is not supported"));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
index 9c941d2..0fe102f 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/GetVacationResponseTest.java
@@ -261,7 +261,8 @@ public abstract class GetVacationResponseTest {
         .then()
             .statusCode(200)
             .body(NAME, equalTo("error"))
-            .body(ARGUMENTS + ".type", equalTo("Not yet implemented"));
+            .body(ARGUMENTS + ".type", equalTo("invalidArguments"))
+            .body(ARGUMENTS + ".description", equalTo("The field 'accountId' of 'GetVacationRequest'
is not supported"));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
index 66e61e2..dae7e9e 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMailboxesMethodTest.java
@@ -485,7 +485,8 @@ public abstract class SetMailboxesMethodTest {
         .then()
             .statusCode(200)
             .body(NAME, equalTo("error"))
-            .body(ARGUMENTS + ".type", equalTo("Not yet implemented"));
+            .body(ARGUMENTS + ".type", equalTo("invalidArguments"))
+            .body(ARGUMENTS + ".description", equalTo("The field 'role' of 'MailboxCreateRequest'
is not supported"));
     }
 
     @Test
@@ -513,7 +514,8 @@ public abstract class SetMailboxesMethodTest {
         .then()
             .statusCode(200)
             .body(NAME, equalTo("error"))
-            .body(ARGUMENTS + ".type", equalTo("Not yet implemented"));
+            .body(ARGUMENTS + ".type", equalTo("invalidArguments"))
+            .body(ARGUMENTS + ".description", equalTo("The field 'sortOrder' of 'MailboxCreateRequest'
is not supported"));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
index 3d5fda6..f3cbaa3 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetMessagesMethodTest.java
@@ -198,7 +198,8 @@ public abstract class SetMessagesMethodTest {
             .log().ifValidationFails()
             .statusCode(200)
             .body(NAME, equalTo("error"))
-            .body(ARGUMENTS + ".type", equalTo("Not yet implemented"));
+            .body(ARGUMENTS + ".type", equalTo("invalidArguments"))
+            .body(ARGUMENTS + ".description", equalTo("The field 'accountId' of 'SetMessagesRequest'
is not supported"));
     }
 
     @Test
@@ -212,7 +213,8 @@ public abstract class SetMessagesMethodTest {
             .log().ifValidationFails()
             .statusCode(200)
             .body(NAME, equalTo("error"))
-            .body(ARGUMENTS + ".type", equalTo("Not yet implemented"));
+            .body(ARGUMENTS + ".type", equalTo("invalidArguments"))
+            .body(ARGUMENTS + ".description", equalTo("The field 'ifInState' of 'SetMessagesRequest'
is not supported"));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
index d5f4257..a5c5ad8 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/SetVacationResponseTest.java
@@ -388,7 +388,8 @@ public abstract class SetVacationResponseTest {
         .then()
             .statusCode(200)
             .body(NAME, equalTo("error"))
-            .body(ARGUMENTS + ".type", equalTo("Not yet implemented"));
+            .body(ARGUMENTS + ".type", equalTo("invalidArguments"))
+            .body(ARGUMENTS + ".description", equalTo("The field 'accountId' of 'SetVacationRequest'
is not supported"));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
index f9bd5db..e2bc4ca 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/GetMessagesMethodStepdefs.java
@@ -505,8 +505,16 @@ public class GetMessagesMethodStepdefs {
         return Joiner.on(": ").join(pair);
     }
 
-    @Then("^an error \"([^\"]*)\" is returned$")
-    public void error(String type) {
+    @Then("^an error \"([^\"]*)\" with type \"([^\"]*)\" is returned$")
+    public void error(String description, String type) {
+        assertThat(httpClient.response.getStatusLine().getStatusCode()).isEqualTo(200);
+        assertThat(httpClient.jsonPath.<String>read(NAME)).isEqualTo("error");
+        assertThat(httpClient.jsonPath.<String>read(ARGUMENTS + ".type")).isEqualTo(type);
+        assertThat(httpClient.jsonPath.<String>read(ARGUMENTS + ".description")).isEqualTo(description);
+    }
+
+    @Then("^an error of type \"([^\"]*)\" is returned$")
+    public void errorType(String type) {
         assertThat(httpClient.response.getStatusLine().getStatusCode()).isEqualTo(200);
         assertThat(httpClient.jsonPath.<String>read(NAME)).isEqualTo("error");
         assertThat(httpClient.jsonPath.<String>read(ARGUMENTS + ".type")).isEqualTo(type);

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
index 7b5f854..8237ade 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/GetMessages.feature
@@ -36,7 +36,7 @@ Feature: GetMessages method
 
   Scenario: Retrieving messages with a non null accountId should return a NotSupported error
     When "alice@domain.tld" ask for messages using its accountId
-    Then an error "Not yet implemented" is returned
+    Then an error "The field 'accountId' of 'GetMessagesMethod' is not supported" with type
"invalidArguments" is returned
 
   Scenario: Unknown arguments should be ignored when retrieving messages
     When "alice@domain.tld" ask for messages using unknown arguments
@@ -46,7 +46,7 @@ Feature: GetMessages method
 
   Scenario: Retrieving messages with invalid argument should return an InvalidArguments error
     When "alice@domain.tld" ask for messages using invalid argument
-    Then an error "invalidArguments" is returned
+    Then an error of type "invalidArguments" is returned
     And the description is "N/A (through reference chain: org.apache.james.jmap.model.Builder["ids"])"
 
   Scenario: Retrieving messages should return empty list when no message

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap/src/main/java/org/apache/james/jmap/JmapFieldNotSupportedException.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/JmapFieldNotSupportedException.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/JmapFieldNotSupportedException.java
new file mode 100644
index 0000000..ed35fa8
--- /dev/null
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/JmapFieldNotSupportedException.java
@@ -0,0 +1,41 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.jmap;
+
+import org.apache.commons.lang.NotImplementedException;
+
+public class JmapFieldNotSupportedException extends NotImplementedException {
+    private final String issuer;
+    private final String field;
+
+    public JmapFieldNotSupportedException(String issuer, String field) {
+        super();
+        this.issuer = issuer;
+        this.field = field;
+    }
+
+    public String getField() {
+        return field;
+    }
+
+    public String getIssuer() {
+        return issuer;
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
index 7c7f066..ae4c0e3 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
@@ -27,7 +27,7 @@ import java.util.stream.Stream;
 
 import javax.inject.Inject;
 
-import org.apache.commons.lang.NotImplementedException;
+import org.apache.james.jmap.JmapFieldNotSupportedException;
 import org.apache.james.jmap.json.FieldNamePropertyFilter;
 import org.apache.james.jmap.model.ClientId;
 import org.apache.james.jmap.model.GetMessagesRequest;
@@ -61,6 +61,7 @@ import com.google.common.collect.ImmutableSet;
 public class GetMessagesMethod implements Method {
 
     public static final String HEADERS_FILTER = "headersFilter";
+    private static final String ISSUER = "GetMessagesMethod";
     private static final Logger LOGGER = LoggerFactory.getLogger(GetMessagesMethod.class);
     private static final Method.Request.Name METHOD_NAME = Method.Request.name("getMessages");
     private static final Method.Response.Name RESPONSE_NAME = Method.Response.name("messages");
@@ -128,7 +129,7 @@ public class GetMessagesMethod implements Method {
     }
 
     private GetMessagesResponse getMessagesResponse(MailboxSession mailboxSession, GetMessagesRequest
getMessagesRequest) {
-        getMessagesRequest.getAccountId().ifPresent((input) -> notImplemented());
+        getMessagesRequest.getAccountId().ifPresent((input) -> notImplemented("accountId"));
 
         try {
             return GetMessagesResponse.builder()
@@ -187,7 +188,7 @@ public class GetMessagesMethod implements Method {
         };
     }
 
-    private static void notImplemented() {
-        throw new NotImplementedException();
+    private static void notImplemented(String field) {
+        throw new JmapFieldNotSupportedException(ISSUER, field);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/RequestHandler.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/RequestHandler.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/RequestHandler.java
index f62273c..a8c42f3 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/RequestHandler.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/RequestHandler.java
@@ -30,7 +30,7 @@ import java.util.stream.Stream;
 
 import javax.inject.Inject;
 
-import org.apache.commons.lang.NotImplementedException;
+import org.apache.james.jmap.JmapFieldNotSupportedException;
 import org.apache.james.jmap.model.AuthenticatedProtocolRequest;
 import org.apache.james.jmap.model.ProtocolResponse;
 import org.apache.james.mailbox.MailboxSession;
@@ -77,24 +77,28 @@ public class RequestHandler {
                         return method.process(jmapRequest, request.getClientId(), mailboxSession);
                     } catch (IOException e) {
                         LOGGER.error("Error occured while parsing the request.", e);
-                        if (e.getCause() instanceof NotImplementedException) {
-                            return errorNotImplemented(request);
+                        if (e.getCause() instanceof JmapFieldNotSupportedException) {
+                            return errorNotImplemented((JmapFieldNotSupportedException) e.getCause(),
request);
                         }
-                        return error(request, ErrorResponse.builder()
-                                                        .type("invalidArguments")
-                                                        .description(e.getMessage())
-                                                        .build());
-                    } catch (NotImplementedException e) {
-                        return errorNotImplemented(request);
+                        return error(request, generateInvalidArgumentError(e.getMessage()));
+                    } catch (JmapFieldNotSupportedException e) {
+                        return errorNotImplemented(e, request);
                     }
                 };
     }
 
-    private Stream<JmapResponse> errorNotImplemented(AuthenticatedProtocolRequest request)
{
+    public ErrorResponse generateInvalidArgumentError(String description) {
+        return ErrorResponse.builder()
+            .type("invalidArguments")
+            .description(description)
+            .build();
+    }
+
+    private Stream<JmapResponse> errorNotImplemented(JmapFieldNotSupportedException
error, AuthenticatedProtocolRequest request) {
         return Stream.of(
                 JmapResponse.builder()
                     .clientId(request.getClientId())
-                    .error("Not yet implemented")
+                    .error(generateInvalidArgumentError("The field '" + error.getField()
+ "' of '" + error.getIssuer() + "' is not supported"))
                     .build());
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetMailboxesRequest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetMailboxesRequest.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetMailboxesRequest.java
index 6e435f8..f7ece2f 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetMailboxesRequest.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetMailboxesRequest.java
@@ -21,7 +21,7 @@ package org.apache.james.jmap.model;
 import java.util.List;
 import java.util.Optional;
 
-import org.apache.commons.lang.NotImplementedException;
+import org.apache.james.jmap.JmapFieldNotSupportedException;
 import org.apache.james.jmap.methods.JmapRequest;
 import org.apache.james.mailbox.model.MailboxId;
 
@@ -33,6 +33,7 @@ import com.google.common.collect.ImmutableSet;
 
 @JsonDeserialize(builder = GetMailboxesRequest.Builder.class)
 public class GetMailboxesRequest implements JmapRequest {
+    private static final String ISSUER = "GetMailboxesRequest";
 
     public static Builder builder() {
         return new Builder();
@@ -52,7 +53,7 @@ public class GetMailboxesRequest implements JmapRequest {
 
         public Builder accountId(String accountId) {
             if (accountId != null) {
-                throw new NotImplementedException();
+                throw new JmapFieldNotSupportedException(ISSUER, "accountId");
             }
             return this;
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetVacationRequest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetVacationRequest.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetVacationRequest.java
index 9f77319..2f75e05 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetVacationRequest.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/GetVacationRequest.java
@@ -19,7 +19,7 @@
 
 package org.apache.james.jmap.model;
 
-import org.apache.commons.lang.NotImplementedException;
+import org.apache.james.jmap.JmapFieldNotSupportedException;
 import org.apache.james.jmap.methods.JmapRequest;
 
 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@@ -27,6 +27,7 @@ import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
 
 @JsonDeserialize(builder = GetVacationRequest.Builder.class)
 public class GetVacationRequest implements JmapRequest {
+    private static final String ISSUER = "GetVacationRequest";
 
     public static Builder builder() {
         return new Builder();
@@ -36,7 +37,7 @@ public class GetVacationRequest implements JmapRequest {
     public static class Builder {
 
         public Builder accountId(String accountId) {
-            throw new NotImplementedException();
+            throw new JmapFieldNotSupportedException(ISSUER, "accountId");
         }
 
         public GetVacationRequest build() {

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetMessagesRequest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetMessagesRequest.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetMessagesRequest.java
index ec6b1a8..325191f 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetMessagesRequest.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetMessagesRequest.java
@@ -25,7 +25,7 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.function.Function;
 
-import org.apache.commons.lang.NotImplementedException;
+import org.apache.james.jmap.JmapFieldNotSupportedException;
 import org.apache.james.jmap.methods.JmapRequest;
 import org.apache.james.jmap.methods.UpdateMessagePatchConverter;
 import org.apache.james.jmap.methods.ValueWithId.CreationMessageEntry;
@@ -43,6 +43,7 @@ import com.google.common.collect.Maps;
 
 @JsonDeserialize(builder = SetMessagesRequest.Builder.class)
 public class SetMessagesRequest implements JmapRequest {
+    private static final String ISSUER = "SetMessagesRequest";
 
     public static Builder builder() {
         return new Builder();
@@ -68,14 +69,14 @@ public class SetMessagesRequest implements JmapRequest {
 
         public Builder accountId(String accountId) {
             if (accountId != null) {
-                throw new NotImplementedException();
+                throw new JmapFieldNotSupportedException(ISSUER, "accountId");
             }
             return this;
         }
 
         public Builder ifInState(String ifInState) {
             if (ifInState != null) {
-                throw new NotImplementedException();
+                throw new JmapFieldNotSupportedException(ISSUER, "ifInState");
             }
             return this;
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetVacationRequest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetVacationRequest.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetVacationRequest.java
index 5bf505d..4a1c7d1 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetVacationRequest.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/SetVacationRequest.java
@@ -21,7 +21,7 @@ package org.apache.james.jmap.model;
 
 import java.util.Map;
 
-import org.apache.commons.lang.NotImplementedException;
+import org.apache.james.jmap.JmapFieldNotSupportedException;
 import org.apache.james.jmap.api.vacation.Vacation;
 import org.apache.james.jmap.methods.JmapRequest;
 
@@ -33,6 +33,7 @@ import com.google.common.collect.Maps;
 
 @JsonDeserialize(builder = SetVacationRequest.Builder.class)
 public class SetVacationRequest implements JmapRequest {
+    private static final String ISSUER = "SetVacationRequest";
 
     public static Builder builder() {
         return new Builder();
@@ -45,7 +46,7 @@ public class SetVacationRequest implements JmapRequest {
 
         public Builder accountId(String accountId) {
             if (accountId != null) {
-                throw new NotImplementedException();
+                throw new JmapFieldNotSupportedException(ISSUER, "accountId");
             }
             return this;
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/b44df191/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/mailbox/MailboxCreateRequest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/mailbox/MailboxCreateRequest.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/mailbox/MailboxCreateRequest.java
index e473726..ee3e7ff 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/mailbox/MailboxCreateRequest.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/mailbox/MailboxCreateRequest.java
@@ -22,7 +22,7 @@ package org.apache.james.jmap.model.mailbox;
 import java.util.Objects;
 import java.util.Optional;
 
-import org.apache.commons.lang.NotImplementedException;
+import org.apache.james.jmap.JmapFieldNotSupportedException;
 import org.apache.james.jmap.model.MailboxCreationId;
 import org.apache.james.mailbox.Role;
 
@@ -35,6 +35,7 @@ import com.google.common.base.Strings;
 
 @JsonDeserialize(builder = MailboxCreateRequest.Builder.class)
 public class MailboxCreateRequest {
+    private static final String ISSUER = "MailboxCreateRequest";
 
     public static Builder builder() {
         return new Builder();
@@ -76,12 +77,12 @@ public class MailboxCreateRequest {
 
         public Builder role(Role role) {
             Preconditions.checkNotNull(role);
-            throw new NotImplementedException();
+            throw new JmapFieldNotSupportedException(ISSUER, "role");
         }
 
         public Builder sortOrder(SortOrder sortOrder) {
             Preconditions.checkNotNull(sortOrder);
-            throw new NotImplementedException();
+            throw new JmapFieldNotSupportedException(ISSUER, "sortOrder");
         }
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message