justinmclean commented on code in PR #7310:
URL: https://github.com/apache/gravitino/pull/7310#discussion_r2117651191


##########
core/src/main/java/org/apache/gravitino/connector/PropertiesMetadata.java:
##########
@@ -149,11 +149,13 @@ default PropertyEntry<?> getPropertyEntry(String 
propertyName) throws IllegalArg
     if (!containsProperty(propertyName)) {
       throw new IllegalArgumentException("Property is not defined: " + 
propertyName);
     }
+
     return getNonPrefixEntry(propertyName).isPresent()
         ? getNonPrefixEntry(propertyName).get()
-        : getPropertyPrefixEntry(propertyName).get();
+        : (getPropertyPrefixEntry(propertyName).isPresent()
+            ? getPropertyPrefixEntry(propertyName).get()
+            : null);

Review Comment:
   This appears somewhat complex at first glance, so it may be better to use an 
if statement. I'm also concerned that returning null could cause a NPE 
elsewhere, so it may be better to throw an exception. You might want to 
double-check the unit tests for this as well.



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