Copilot commented on code in PR #13219:
URL: https://github.com/apache/gravitino/pull/13219#discussion_r4025691804


##########
api/src/main/java/org/apache/gravitino/authorization/MetadataObjectChange.java:
##########
@@ -180,28 +180,28 @@ public List<String> getLocations() {
 
     /**
      * Compares this RemoveMetadataObject instance with another object for 
equality. The comparison
-     * is based on the old metadata entity.
+     * is based on the metadata entity and the locations.
      *
      * @param o The object to compare with this instance.
-     * @return true if the given object represents the same rename metadata 
entity; false otherwise.
+     * @return true if the given object represents the same remove metadata 
entity; false otherwise.
      */
     @Override
     public boolean equals(Object o) {
       if (this == o) return true;
       if (o == null || getClass() != o.getClass()) return false;
-      RenameMetadataObject that = (RenameMetadataObject) o;
-      return metadataObject.equals(that.metadataObject);
+      RemoveMetadataObject that = (RemoveMetadataObject) o;
+      return metadataObject.equals(that.metadataObject) && 
locations.equals(that.locations);

Review Comment:
   `remove` stores the caller-provided `locations` without rejecting or 
normalizing null, so `MetadataObjectChange.remove(metadataObject, null)` is 
constructible. Comparing two distinct such instances now throws 
`NullPointerException` at this expression instead of returning a result; use 
`Objects.equals(locations, that.locations)` and add a null-location regression 
test.
   
   This issue also appears on line 204 of the same file.



-- 
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