From ebb19c5816399b83c42b8f9194dbf3d9296975a3 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Thu, 30 Jul 2026 07:45:56 +0000
Subject: [PATCH] Fix concurrency and equals-contract CodeQL alerts (#785)

---
 opendj-server-legacy/src/main/java/org/opends/server/plugins/profiler/ProfileStack.java |   50 +++++++++++++++++---------------------------------
 1 files changed, 17 insertions(+), 33 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/plugins/profiler/ProfileStack.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/profiler/ProfileStack.java
index 70129c1..29d4cfa 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/profiler/ProfileStack.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/profiler/ProfileStack.java
@@ -13,12 +13,12 @@
  *
  * Copyright 2006-2008 Sun Microsystems, Inc.
  * Portions Copyright 2014-2016 ForgeRock AS.
+ * Portions Copyright 2026 3A Systems, LLC.
  */
 package org.opends.server.plugins.profiler;
 
 import java.io.IOException;
 
-import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.forgerock.opendj.io.ASN1Reader;
 import org.forgerock.opendj.io.ASN1Writer;
 
@@ -28,11 +28,6 @@
  */
 public class ProfileStack
 {
-  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
-
-
-
-
   /**
    * The line number that will be used for stack frames in which the line number
    * is unknown but it is not a native method.
@@ -240,43 +235,32 @@
   @Override
   public boolean equals(Object o)
   {
-    if (o == null)
-    {
-      return false;
-    }
-    else if (this == o)
+    if (this == o)
     {
       return true;
     }
-
-
-    try
+    if (!(o instanceof ProfileStack))
     {
-      ProfileStack s = (ProfileStack) o;
+      return false;
+    }
 
-      if (numFrames != s.numFrames)
+    ProfileStack s = (ProfileStack) o;
+    if (numFrames != s.numFrames)
+    {
+      return false;
+    }
+
+    for (int i=0; i < numFrames; i++)
+    {
+      if (lineNumbers[i] != s.lineNumbers[i] ||
+          !classNames[i].equals(s.classNames[i]) ||
+          !methodNames[i].equals(s.methodNames[i]))
       {
         return false;
       }
-
-      for (int i=0; i < numFrames; i++)
-      {
-        if (lineNumbers[i] != s.lineNumbers[i] ||
-            !classNames[i].equals(s.classNames[i]) ||
-            !methodNames[i].equals(s.methodNames[i]))
-        {
-          return false;
-        }
-      }
-
-      return true;
     }
-    catch (Exception e)
-    {
-      logger.traceException(e);
 
-      return false;
-    }
+    return true;
   }
 
 

--
Gitblit v1.10.0