Skip to content

Fixed import statement for AccessDeniedException

Himanshi Garg requested to merge himanshigarg/fix-import-statement-master into master

We were importing AccessDeniedException from the wrong package. Instead of importing spring's AccessDeniedException, we were importing this exception from java.nio.file package. As a result of this, exception handler for this type of exception was never executed instead exception handler logic for Exception.class was being executed and because of this, we were throwing "500 Internal Server" Error instead of "401 Unauthorized" exception.

Excepted: https://community.opengroup.org/osdu/platform/security-and-compliance/entitlements/-/blob/master/entitlements-v2-core/src/main/java/org/opengroup/osdu/entitlements/v2/errors/SpringExceptionMapper.java#L73

Actual: https://community.opengroup.org/osdu/platform/security-and-compliance/entitlements/-/blob/master/entitlements-v2-core/src/main/java/org/opengroup/osdu/entitlements/v2/errors/SpringExceptionMapper.java#L77

In this PR, I have fixed the import statement for AccessDeniedException and also added unit test for the same.

Merge request reports

Loading