Jaderccesar opened a new pull request, #1705:
URL: https://github.com/apache/commons-lang/pull/1705

   ## Problem
   SpotBugs reports ES_COMPARING_STRINGS_WITH_EQ in 
ObjectToStringComparator.compare().
   The original code compared String objects using `==`, which checks reference 
equality
   rather than content equality. This can cause incorrect comparisons when two 
distinct
   String objects have the same content.
   
   ## Solution
   - Removed the `if (string1 == string2)` reference comparison
   - Added null checks before content comparison (to avoid NullPointerException)
   - Used `string1.equals(string2)` for correct content-based comparison
   
   ## Testing
   Existing tests in ObjectToStringComparatorTest cover this method.
   No new behavior is introduced, only the comparison mechanism is corrected.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to