Commit 66ccb09a authored by Artem Dobrynin (EPAM)'s avatar Artem Dobrynin (EPAM) Committed by Riabokon Stanislav(EPAM)[GCP]
Browse files

Add error message for partition exception response (GONRG-2963)

parent aedc3627
...@@ -46,11 +46,11 @@ The following software have components provided under the terms of this license: ...@@ -46,11 +46,11 @@ The following software have components provided under the terms of this license:
- Apache Commons Pool (from https://commons.apache.org/proper/commons-pool/) - Apache Commons Pool (from https://commons.apache.org/proper/commons-pool/)
- Apache Commons Text (from https://commons.apache.org/proper/commons-text) - Apache Commons Text (from https://commons.apache.org/proper/commons-text)
- Apache Geronimo JMS Spec 2.0 (from http://geronimo.apache.org/maven/${siteId}/${version}) - Apache Geronimo JMS Spec 2.0 (from http://geronimo.apache.org/maven/${siteId}/${version})
- Apache Groovy (from https://groovy-lang.org)
- Apache Groovy (from http://groovy-lang.org) - Apache Groovy (from http://groovy-lang.org)
- Apache Groovy (from https://groovy-lang.org)
- Apache Groovy (from http://groovy-lang.org) - Apache Groovy (from http://groovy-lang.org)
- Apache Groovy (from http://groovy-lang.org) - Apache Groovy (from http://groovy-lang.org)
- Apache Groovy (from https://groovy-lang.org)
- Apache Groovy (from https://groovy-lang.org)
- Apache Log4j API (from https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api) - Apache Log4j API (from https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api)
- Apache Log4j Core (from https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core) - Apache Log4j Core (from https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core)
- Apache Log4j JUL Adapter (from https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-jul) - Apache Log4j JUL Adapter (from https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-jul)
...@@ -213,6 +213,7 @@ The following software have components provided under the terms of this license: ...@@ -213,6 +213,7 @@ The following software have components provided under the terms of this license:
- OpenCensus (from https://github.com/census-instrumentation/opencensus-java) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java)
- OpenCensus (from https://github.com/census-instrumentation/opencensus-java) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java)
- PWDB :: Database (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/database) - PWDB :: Database (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/database)
- PostgreSQL JDBC Driver (from https://jdbc.postgresql.org)
- PowerMock (from http://www.powermock.org) - PowerMock (from http://www.powermock.org)
- Protocol Buffer extensions to the Google HTTP Client Library for Java. (from https://repo1.maven.org/maven2/com/google/http-client/google-http-client-protobuf) - Protocol Buffer extensions to the Google HTTP Client Library for Java. (from https://repo1.maven.org/maven2/com/google/http-client/google-http-client-protobuf)
- Proton-J (from https://repo1.maven.org/maven2/org/apache/qpid/proton-j) - Proton-J (from https://repo1.maven.org/maven2/org/apache/qpid/proton-j)
...@@ -227,18 +228,7 @@ The following software have components provided under the terms of this license: ...@@ -227,18 +228,7 @@ The following software have components provided under the terms of this license:
- SnakeYAML (from http://www.snakeyaml.org) - SnakeYAML (from http://www.snakeyaml.org)
- Spring AOP (from https://github.com/spring-projects/spring-framework) - Spring AOP (from https://github.com/spring-projects/spring-framework)
- Spring Beans (from https://github.com/spring-projects/spring-framework) - Spring Beans (from https://github.com/spring-projects/spring-framework)
- Spring Boot AOP Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Actuator (from http://projects.spring.io/spring-boot/)
- Spring Boot Actuator Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Data JDBC Starter (from https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-data-jdbc)
- Spring Boot JDBC Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Log4j 2 Starter (from https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-log4j2)
- Spring Boot Security Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Test Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Tomcat Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Undertow Starter (from https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-undertow) - Spring Boot Undertow Starter (from https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-undertow)
- Spring Boot Web Starter (from http://projects.spring.io/spring-boot/)
- Spring Commons Logging Bridge (from https://github.com/spring-projects/spring-framework) - Spring Commons Logging Bridge (from https://github.com/spring-projects/spring-framework)
- Spring Context (from https://github.com/spring-projects/spring-framework) - Spring Context (from https://github.com/spring-projects/spring-framework)
- Spring Core (from https://github.com/spring-projects/spring-framework) - Spring Core (from https://github.com/spring-projects/spring-framework)
...@@ -312,7 +302,6 @@ The following software have components provided under the terms of this license: ...@@ -312,7 +302,6 @@ The following software have components provided under the terms of this license:
- org.opentest4j:opentest4j (from https://github.com/ota4j-team/opentest4j) - org.opentest4j:opentest4j (from https://github.com/ota4j-team/opentest4j)
- org.xmlunit:xmlunit-core (from http://www.xmlunit.org/) - org.xmlunit:xmlunit-core (from http://www.xmlunit.org/)
- perfmark:perfmark-api (from https://github.com/perfmark/perfmark) - perfmark:perfmark-api (from https://github.com/perfmark/perfmark)
- pgdjbc Postgresql-jre7 (from https://jdbc.postgresql.org)
- picocli - a mighty tiny Command Line Interface (from http://picocli.info) - picocli - a mighty tiny Command Line Interface (from http://picocli.info)
- powermock-api-support (from https://repo1.maven.org/maven2/org/powermock/powermock-api-support) - powermock-api-support (from https://repo1.maven.org/maven2/org/powermock/powermock-api-support)
- powermock-core (from http://www.powermock.org) - powermock-core (from http://www.powermock.org)
...@@ -341,21 +330,32 @@ The following software have components provided under the terms of this license: ...@@ -341,21 +330,32 @@ The following software have components provided under the terms of this license:
- resilience4j (from https://resilience4j.readme.io) - resilience4j (from https://resilience4j.readme.io)
- rxjava (from https://github.com/ReactiveX/RxJava) - rxjava (from https://github.com/ReactiveX/RxJava)
- spring-boot (from https://spring.io/projects/spring-boot) - spring-boot (from https://spring.io/projects/spring-boot)
- spring-boot-actuator (from https://spring.io/projects/spring-boot)
- spring-boot-actuator-autoconfigure (from https://spring.io/projects/spring-boot) - spring-boot-actuator-autoconfigure (from https://spring.io/projects/spring-boot)
- spring-boot-autoconfigure (from https://spring.io/projects/spring-boot) - spring-boot-autoconfigure (from https://spring.io/projects/spring-boot)
- spring-boot-dependencies (from https://spring.io/projects/spring-boot) - spring-boot-dependencies (from https://spring.io/projects/spring-boot)
- spring-boot-starter (from https://spring.io/projects/spring-boot)
- spring-boot-starter-actuator (from https://spring.io/projects/spring-boot)
- spring-boot-starter-aop (from https://spring.io/projects/spring-boot)
- spring-boot-starter-data-jdbc (from https://spring.io/projects/spring-boot)
- spring-boot-starter-jdbc (from https://spring.io/projects/spring-boot)
- spring-boot-starter-json (from https://spring.io/projects/spring-boot) - spring-boot-starter-json (from https://spring.io/projects/spring-boot)
- spring-boot-starter-log4j2 (from https://spring.io/projects/spring-boot)
- spring-boot-starter-logging (from https://spring.io/projects/spring-boot) - spring-boot-starter-logging (from https://spring.io/projects/spring-boot)
- spring-boot-starter-security (from https://spring.io/projects/spring-boot)
- spring-boot-starter-test (from https://spring.io/projects/spring-boot)
- spring-boot-starter-tomcat (from https://spring.io/projects/spring-boot)
- spring-boot-starter-validation (from https://spring.io/projects/spring-boot) - spring-boot-starter-validation (from https://spring.io/projects/spring-boot)
- spring-boot-starter-web (from https://spring.io/projects/spring-boot)
- spring-boot-test (from https://spring.io/projects/spring-boot) - spring-boot-test (from https://spring.io/projects/spring-boot)
- spring-boot-test-autoconfigure (from https://spring.io/projects/spring-boot) - spring-boot-test-autoconfigure (from https://spring.io/projects/spring-boot)
- spring-security-config (from https://spring.io/spring-security) - spring-security-config (from https://spring.io/spring-security)
- spring-security-core (from https://spring.io/projects/spring-security) - spring-security-core (from https://spring.io/spring-security)
- spring-security-oauth2-client (from https://spring.io/spring-security) - spring-security-oauth2-client (from https://spring.io/spring-security)
- spring-security-oauth2-core (from https://spring.io/spring-security) - spring-security-oauth2-core (from https://spring.io/spring-security)
- spring-security-oauth2-jose (from https://spring.io/spring-security) - spring-security-oauth2-jose (from https://spring.io/spring-security)
- spring-security-oauth2-resource-server (from https://spring.io/spring-security) - spring-security-oauth2-resource-server (from https://spring.io/spring-security)
- spring-security-web (from https://spring.io/projects/spring-security) - spring-security-web (from https://spring.io/spring-security)
- springfox-core (from https://github.com/springfox/springfox) - springfox-core (from https://github.com/springfox/springfox)
- springfox-schema (from https://github.com/springfox/springfox) - springfox-schema (from https://github.com/springfox/springfox)
- springfox-spi (from https://github.com/springfox/springfox) - springfox-spi (from https://github.com/springfox/springfox)
...@@ -369,7 +369,7 @@ The following software have components provided under the terms of this license: ...@@ -369,7 +369,7 @@ The following software have components provided under the terms of this license:
- tomcat-annotations-api (from https://tomcat.apache.org/) - tomcat-annotations-api (from https://tomcat.apache.org/)
- tomcat-embed-core (from http://tomcat.apache.org/) - tomcat-embed-core (from http://tomcat.apache.org/)
- tomcat-embed-core (from http://tomcat.apache.org/) - tomcat-embed-core (from http://tomcat.apache.org/)
- tomcat-embed-websocket (from http://tomcat.apache.org/) - tomcat-embed-websocket (from https://tomcat.apache.org/)
- wildfly-common (from ) - wildfly-common (from )
======================================================================== ========================================================================
...@@ -392,10 +392,10 @@ The following software have components provided under the terms of this license: ...@@ -392,10 +392,10 @@ The following software have components provided under the terms of this license:
- Jodd BeanUtil (from http://jodd.org) - Jodd BeanUtil (from http://jodd.org)
- Jodd Core (from http://jodd.org) - Jodd Core (from http://jodd.org)
- Jodd Core (from http://jodd.org) - Jodd Core (from http://jodd.org)
- Reflections (from http://code.google.com/p/reflections/) - PostgreSQL JDBC Driver (from https://jdbc.postgresql.org)
- Reflections (from http://github.com/ronmamo/reflections)
- Stax2 API (from http://github.com/FasterXML/stax2-api) - Stax2 API (from http://github.com/FasterXML/stax2-api)
- ThreeTen backport (from https://www.threeten.org/threetenbp) - ThreeTen backport (from https://www.threeten.org/threetenbp)
- pgdjbc Postgresql-jre7 (from https://jdbc.postgresql.org)
======================================================================== ========================================================================
BSD-3-Clause BSD-3-Clause
...@@ -431,11 +431,12 @@ The following software have components provided under the terms of this license: ...@@ -431,11 +431,12 @@ The following software have components provided under the terms of this license:
- Mockito (from http://www.mockito.org) - Mockito (from http://www.mockito.org)
- Netty/All-in-One (from https://repo1.maven.org/maven2/io/netty/netty-all) - Netty/All-in-One (from https://repo1.maven.org/maven2/io/netty/netty-all)
- Netty/Codec/HTTP (from https://repo1.maven.org/maven2/io/netty/netty-codec-http) - Netty/Codec/HTTP (from https://repo1.maven.org/maven2/io/netty/netty-codec-http)
- PostgreSQL JDBC Driver (from https://jdbc.postgresql.org)
- Protocol Buffers [Core] (from https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java) - Protocol Buffers [Core] (from https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java)
- Protocol Buffers [Util] (from https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java-util) - Protocol Buffers [Util] (from https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java-util)
- Redisson (from http://redisson.org) - Redisson (from http://redisson.org)
- Redisson (from http://redisson.org) - Redisson (from http://redisson.org)
- Reflections (from http://code.google.com/p/reflections/) - Reflections (from http://github.com/ronmamo/reflections)
- SnakeYAML (from http://www.snakeyaml.org) - SnakeYAML (from http://www.snakeyaml.org)
- Spring Core (from https://github.com/spring-projects/spring-framework) - Spring Core (from https://github.com/spring-projects/spring-framework)
- ThreeTen backport (from https://www.threeten.org/threetenbp) - ThreeTen backport (from https://www.threeten.org/threetenbp)
...@@ -444,7 +445,6 @@ The following software have components provided under the terms of this license: ...@@ -444,7 +445,6 @@ The following software have components provided under the terms of this license:
- jbcrypt (from http://www.mindrot.org/) - jbcrypt (from http://www.mindrot.org/)
- jcabi-log (from https://repo1.maven.org/maven2/com/jcabi/jcabi-log) - jcabi-log (from https://repo1.maven.org/maven2/com/jcabi/jcabi-log)
- jcabi-manifests (from https://repo1.maven.org/maven2/com/jcabi/jcabi-manifests) - jcabi-manifests (from https://repo1.maven.org/maven2/com/jcabi/jcabi-manifests)
- pgdjbc Postgresql-jre7 (from https://jdbc.postgresql.org)
======================================================================== ========================================================================
CC-BY-2.5 CC-BY-2.5
...@@ -706,7 +706,7 @@ The following software have components provided under the terms of this license: ...@@ -706,7 +706,7 @@ The following software have components provided under the terms of this license:
- mockito-junit-jupiter (from https://github.com/mockito/mockito) - mockito-junit-jupiter (from https://github.com/mockito/mockito)
- msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java) - msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java)
- msal4j-persistence-extension (from https://github.com/AzureAD/microsoft-authentication-extensions-for-java) - msal4j-persistence-extension (from https://github.com/AzureAD/microsoft-authentication-extensions-for-java)
- spring-security-core (from https://spring.io/projects/spring-security) - spring-security-core (from https://spring.io/spring-security)
======================================================================== ========================================================================
MPL-1.1 MPL-1.1
...@@ -760,7 +760,7 @@ WTFPL ...@@ -760,7 +760,7 @@ WTFPL
======================================================================== ========================================================================
The following software have components provided under the terms of this license: The following software have components provided under the terms of this license:
- Reflections (from http://code.google.com/p/reflections/) - Reflections (from http://github.com/ronmamo/reflections)
======================================================================== ========================================================================
public-domain public-domain
...@@ -781,13 +781,13 @@ The following software have components provided under the terms of this license: ...@@ -781,13 +781,13 @@ The following software have components provided under the terms of this license:
- Microsoft Azure SDK for EventGrid Management (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure SDK for EventGrid Management (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure SDK for SQL API of Azure Cosmos DB Service (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure SDK for SQL API of Azure Cosmos DB Service (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure client library for Blob Storage (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure client library for Blob Storage (from https://github.com/Azure/azure-sdk-for-java)
- PostgreSQL JDBC Driver (from https://jdbc.postgresql.org)
- Project Lombok (from https://projectlombok.org) - Project Lombok (from https://projectlombok.org)
- Project Lombok (from https://projectlombok.org) - Project Lombok (from https://projectlombok.org)
- Spring Web (from https://github.com/spring-projects/spring-framework) - Spring Web (from https://github.com/spring-projects/spring-framework)
- azure-documentdb (from https://azure.microsoft.com/en-us/services/cosmos-db/) - azure-documentdb (from https://azure.microsoft.com/en-us/services/cosmos-db/)
- botocore (from https://github.com/boto/botocore) - botocore (from https://github.com/boto/botocore)
- msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java) - msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java)
- pgdjbc Postgresql-jre7 (from https://jdbc.postgresql.org)
- reactive-streams (from http://www.reactive-streams.org/) - reactive-streams (from http://www.reactive-streams.org/)
======================================================================== ========================================================================
...@@ -809,7 +809,7 @@ The following software have components provided under the terms of this license: ...@@ -809,7 +809,7 @@ The following software have components provided under the terms of this license:
- Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api) - Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api)
- Jodd BeanUtil (from http://jodd.org) - Jodd BeanUtil (from http://jodd.org)
- Jodd Core (from http://jodd.org) - Jodd Core (from http://jodd.org)
- PostgreSQL JDBC Driver (from https://jdbc.postgresql.org)
- Spongy Castle (from http://rtyley.github.io/spongycastle/) - Spongy Castle (from http://rtyley.github.io/spongycastle/)
- pgdjbc Postgresql-jre7 (from https://jdbc.postgresql.org)
...@@ -3,6 +3,7 @@ package org.opengroup.osdu.entitlements.v2.errors; ...@@ -3,6 +3,7 @@ package org.opengroup.osdu.entitlements.v2.errors;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException; import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog;
import org.opengroup.osdu.core.common.model.http.AppError;
import org.opengroup.osdu.core.common.model.http.AppException; import org.opengroup.osdu.core.common.model.http.AppException;
import org.opengroup.osdu.core.common.partition.PartitionException; import org.opengroup.osdu.core.common.partition.PartitionException;
import org.opengroup.osdu.entitlements.v2.validation.PartitionHeaderValidationService; import org.opengroup.osdu.entitlements.v2.validation.PartitionHeaderValidationService;
...@@ -34,7 +35,7 @@ public class SpringExceptionMapper extends ResponseEntityExceptionHandler { ...@@ -34,7 +35,7 @@ public class SpringExceptionMapper extends ResponseEntityExceptionHandler {
@ExceptionHandler(AppException.class) @ExceptionHandler(AppException.class)
protected ResponseEntity<Object> handleAppException(AppException e) { protected ResponseEntity<Object> handleAppException(AppException e) {
if (e.getOriginalException() instanceof PartitionException) { if (e.getOriginalException() instanceof PartitionException) {
e.getError().setCode(HttpStatus.UNAUTHORIZED.value()); handlePartitionException(e.getError());
} }
return this.getErrorResponse(e); return this.getErrorResponse(e);
...@@ -71,6 +72,12 @@ public class SpringExceptionMapper extends ResponseEntityExceptionHandler { ...@@ -71,6 +72,12 @@ public class SpringExceptionMapper extends ResponseEntityExceptionHandler {
return this.getErrorResponse(new AppException(HttpStatus.INTERNAL_SERVER_ERROR.value(), HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), "An unknown error has occurred", e)); return this.getErrorResponse(new AppException(HttpStatus.INTERNAL_SERVER_ERROR.value(), HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), "An unknown error has occurred", e));
} }
private void handlePartitionException(AppError error) {
error.setCode(HttpStatus.UNAUTHORIZED.value());
error.setReason("Partition Service issue");
error.setMessage("Cannot authorize user in requested partition");
}
private ResponseEntity<Object> getErrorResponse(AppException e) { private ResponseEntity<Object> getErrorResponse(AppException e) {
if (e.getCause() instanceof Exception) { if (e.getCause() instanceof Exception) {
Exception original = (Exception) e.getCause(); Exception original = (Exception) e.getCause();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment