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 a8bcc04c15957fa7bc35e1f97a6d82771ad69c7c Author: Benoit Tellier <[email protected]> AuthorDate: Fri Jan 3 14:36:08 2020 +0700 [Refactoring] DLPConfigurationRoute should rely on standard error handling --- .../apache/james/webadmin/routes/DLPConfigurationRoutes.java | 11 ----------- .../james/webadmin/routes/DLPConfigurationRoutesTest.java | 6 +++--- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DLPConfigurationRoutes.java b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DLPConfigurationRoutes.java index cde7141..9dc3e32 100644 --- a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DLPConfigurationRoutes.java +++ b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DLPConfigurationRoutes.java @@ -239,8 +239,6 @@ public class DLPConfigurationRoutes implements Routes { validateDomainInList(domain); return domain; - } catch (IllegalArgumentException e) { - throw invalidDomain(String.format("Invalid request for domain: %s", domainName), e); } catch (DomainListException e) { throw serverError(String.format("Cannot recognize domain: %s in domain list", domainName), e); } @@ -252,15 +250,6 @@ public class DLPConfigurationRoutes implements Routes { } } - private HaltException invalidDomain(String message, Exception e) { - return ErrorResponder.builder() - .statusCode(HttpStatus.BAD_REQUEST_400) - .type(ErrorType.INVALID_ARGUMENT) - .message(message) - .cause(e) - .haltError(); - } - private HaltException serverError(String message, Exception e) { return ErrorResponder.builder() .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500) diff --git a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DLPConfigurationRoutesTest.java b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DLPConfigurationRoutesTest.java index 151f622..68a2ae8 100644 --- a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DLPConfigurationRoutesTest.java +++ b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DLPConfigurationRoutesTest.java @@ -325,7 +325,7 @@ class DLPConfigurationRoutesTest { .contentType(JSON_CONTENT_TYPE) .body("statusCode", is(HttpStatus.BAD_REQUEST_400)) .body("type", is("InvalidArgument")) - .body("message", is("Invalid request for domain: [email protected]")) + .body("message", is("Invalid arguments supplied in the user request")) .body("details", is("Domain can not be empty nor contain `@` nor `/`")); } @@ -642,7 +642,7 @@ class DLPConfigurationRoutesTest { .contentType(JSON_CONTENT_TYPE) .body("statusCode", is(HttpStatus.BAD_REQUEST_400)) .body("type", is("InvalidArgument")) - .body("message", is("Invalid request for domain: [email protected]")) + .body("message", is("Invalid arguments supplied in the user request")) .body("details", is("Domain can not be empty nor contain `@` nor `/`")); } } @@ -855,7 +855,7 @@ class DLPConfigurationRoutesTest { .contentType(JSON_CONTENT_TYPE) .body("statusCode", is(HttpStatus.BAD_REQUEST_400)) .body("type", is("InvalidArgument")) - .body("message", is("Invalid request for domain: [email protected]")) + .body("message", is("Invalid arguments supplied in the user request")) .body("details", is("Domain can not be empty nor contain `@` nor `/`")); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
