mchades commented on code in PR #7310:
URL: https://github.com/apache/gravitino/pull/7310#discussion_r2123158874
##########
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:
Agree with Justin.
In theory, if the code reaches here, it means that
`getPropertyPrefixEntry(propertyName).isPresent()` will always be `true`
because a check has already been performed on [line
149](https://github.com/apache/gravitino/pull/7310/files#diff-a592f801935de376db898a0461cceaa0ce52e63682ee687aaef40104b3f6cd50R149).
However, for the sake of logic rigor, we can still recheck
`getPropertyPrefixEntry(propertyName).isPresent()` here. If it returns `false`,
we should throw the same exception as on [line
150](https://github.com/apache/gravitino/pull/7310/files#diff-a592f801935de376db898a0461cceaa0ce52e63682ee687aaef40104b3f6cd50R150).
--
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]