Repository: wso2/product-microgateway
Issue: Error log for OPA policies with GET request when analytics enabled

### Description:
Getting below error log for OPA policies when analytics enabled with a get request.

### Steps to reproduce:

1. Create an API with OPA policies added to a GET operation and deploy.
2. Enable analytics in Choreo-Connect
3. Invoke the API. 
4. Below log appears in Choreo Connect.

```


choreo-connect-with-apim-enforcer-1  | [2022-03-23 07:19:02,728][4b0ba5db-a07b-4f62-bf6a-3af2283bcb68][OPA, example.com, /t/example.com/opa/1.0.0] ERROR - {org.wso2.choreo.connect.enforcer.interceptor.MediationPolicyFilter} - OPA validation failed for the request: /t/example.com/opa/1.0.0/* [severity:Minor error_code:6101]
choreo-connect-with-apim-enforcer-1  | Mar 23, 2022 7:19:02 AM io.grpc.internal.SerializingExecutor run
choreo-connect-with-apim-enforcer-1  | SEVERE: Exception while executing runnable io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed@37eb4496
choreo-connect-with-apim-enforcer-1  | java.lang.NullPointerException
choreo-connect-with-apim-enforcer-1  | 	at org.wso2.carbon.apimgt.common.analytics.collectors.impl.fault.AbstractFaultDataCollector.processRequest(AbstractFaultDataCollector.java:53)
choreo-connect-with-apim-enforcer-1  | 	at org.wso2.carbon.apimgt.common.analytics.collectors.impl.fault.AuthFaultDataCollector.collectFaultData(AuthFaultDataCollector.java:51)
choreo-connect-with-apim-enforcer-1  | 	at org.wso2.carbon.apimgt.common.analytics.collectors.impl.FaultyRequestDataCollector.collectData(FaultyRequestDataCollector.java:63)
choreo-connect-with-apim-enforcer-1  | 	at org.wso2.carbon.apimgt.common.analytics.collectors.impl.GenericRequestDataCollector.collectData(GenericRequestDataCollector.java:49)
choreo-connect-with-apim-enforcer-1  | 	at org.wso2.choreo.connect.enforcer.analytics.AnalyticsFilter.handleFailureRequest(AnalyticsFilter.java:214)
choreo-connect-with-apim-enforcer-1  | 	at org.wso2.choreo.connect.enforcer.api.RestAPI.process(RestAPI.java:232)
choreo-connect-with-apim-enforcer-1  | 	at org.wso2.choreo.connect.enforcer.server.HttpRequestHandler.process(HttpRequestHandler.java:64)
choreo-connect-with-apim-enforcer-1  | 	at org.wso2.choreo.connect.enforcer.grpc.ExtAuthService.check(ExtAuthService.java:80)
choreo-connect-with-apim-enforcer-1  | 	at io.envoyproxy.envoy.service.auth.v3.AuthorizationGrpc$MethodHandlers.invoke(AuthorizationGrpc.java:245)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:180)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.ForwardingServerCallListener$SimpleForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:40)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.Contexts$ContextualizedServerCallListener.onHalfClose(Contexts.java:86)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:331)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:814)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
choreo-connect-with-apim-enforcer-1  | 	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
choreo-connect-with-apim-enforcer-1  | 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
choreo-connect-with-apim-enforcer-1  | 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
choreo-connect-with-apim-enforcer-1  | 	at java.base/java.lang.Thread.run(Unknown Source)
choreo-connect-with-apim-enforcer-1  | 

```

### Affected Product Version:
Chreo-Connect-1.1.0-alpha2

### Environment details (with versions):
- OS:
- Client:
- Env (Docker/K8s):

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-members-->

#### Suggested Assignees:
<!--Only to be used by non-members-->


Changed files:
enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/FaultCodeClassifier.java

diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/FaultCodeClassifier.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/FaultCodeClassifier.java
index 7f84fec42..4896a67ed 100644
--- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/FaultCodeClassifier.java
+++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/FaultCodeClassifier.java
@@ -69,13 +69,14 @@ public class FaultCodeClassifier {
                 return FaultSubCategories.Authentication.AUTHENTICATION_FAILURE;
             case APISecurityConstants.API_AUTH_INCORRECT_ACCESS_TOKEN_TYPE:
             case APISecurityConstants.INVALID_SCOPE:
+            case APISecurityConstants.OPA_AUTH_FORBIDDEN:
                 return FaultSubCategories.Authentication.AUTHORIZATION_FAILURE;
             case APISecurityConstants.API_SUBSCRIPTION_BLOCKED:
             case APISecurityConstants.API_AUTH_FORBIDDEN:
             case APISecurityConstants.SUBSCRIPTION_INACTIVE:
                 return FaultSubCategories.Authentication.SUBSCRIPTION_VALIDATION_FAILURE;
             default:
-                return FaultSubCategories.TargetConnectivity.OTHER;
+                return FaultSubCategories.Authentication.OTHER;
         }
     }
 
@@ -123,6 +124,11 @@ public class FaultCodeClassifier {
     }
 
     public boolean isResourceNotFound() {
+        // isResourceNotFound is not used when logEntry is not null, since 404 related events are published based on
+        // logEntries (not based on requestContext)
+        if (logEntry == null) {
+            return false;
+        }
         ResponseFlags responseFlags = logEntry.getCommonProperties().getResponseFlags();
         if (responseFlags == null) {
             return false;