Merge "Fix sonar violations"
authorTian Lee <TianL@amdocs.com>
Mon, 9 Jul 2018 09:08:59 +0000 (09:08 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 9 Jul 2018 09:08:59 +0000 (09:08 +0000)
src/main/java/org/onap/crud/event/GraphEvent.java
src/main/java/org/onap/crud/service/AaiResourceService.java

index 958c227..b189373 100644 (file)
@@ -172,11 +172,28 @@ public class GraphEvent {
   public String toString() {
     return toJson();
   }
-  
+
+  @Override
+  public boolean equals(Object o){
+    if(o == this){
+      return true;
+    }
+
+    if( !(o instanceof GraphEvent)){
+      return false;
+    }
+
+    GraphEvent graphEvent = (GraphEvent) o;
+    return this.dbTransactionId.equals(
+        graphEvent.getDbTransactionId())
+        && this.timestamp == graphEvent.getTimestamp()
+        && this.operation.equals(graphEvent.getOperation()
+    );
+  }
+
   @Override
   public int hashCode() {
-    return Objects.hash(this.dbTransactionId, this.timestamp, this.edge, this.vertex, this.operation,
-              this.result);
+    return Objects.hash(this.dbTransactionId, this.timestamp, this.operation);
   }
 
   public String getObjectKey() {
index c0375b4..881f9fd 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.crud.service;
 \r
 import java.security.cert.X509Certificate;\r
 import java.util.AbstractMap;\r
+import java.util.Arrays;\r
 import java.util.HashSet;\r
 import java.util.Map;\r
 import java.util.Map.Entry;\r
@@ -506,7 +507,7 @@ public class AaiResourceService {
         authUser = subjectDn.toString();\r
       }\r
 \r
-      return this.auth.validateRequest(authUser.toLowerCase(), action.toString() + ":" + authPolicyFunctionName);\r
+      return this.auth.validateRequest(authUser!=null ? authUser.toLowerCase():"", action.toString() + ":" + authPolicyFunctionName);\r
 \r
     } catch (Exception e) {\r
       logResult(action, uri, e);\r
@@ -518,8 +519,7 @@ public class AaiResourceService {
 \r
     logger.error(CrudServiceMsgs.EXCEPTION_DURING_METHOD_CALL,\r
                  op.toString(),\r
-                 uri,\r
-                 e.getStackTrace().toString());\r
+                 uri, Arrays.toString(e.getStackTrace()));\r
 \r
     // Clear the MDC context so that no other transaction inadvertently\r
     // uses our transaction id.\r