billygoatish commented on code in PR #11975:
URL: https://github.com/apache/ozone/pull/11975#discussion_r4574630858
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmLCFilter.java:
##########
@@ -76,6 +78,10 @@ private OmLCFilter(Builder builder) {
* @throws OMException if the filter is invalid.
*/
public void valid(BucketLayout layout) throws OMException {
+ if (tagSet && (tagKey == null || tagValue == null)) {
Review Comment:
Thanks for the feedback! @ChenSammi
I kept `tagSet` to distinguish an empty filter from a tag with both
the key and value missing.
For example, a Java client can pass an `OmLCFilter` through
`ozoneBucket.setLifecycleConfiguration()`. Since both fields default
to `null`, these two cases would otherwise look the same:
```java
new OmLCFilter.Builder().build(); // Empty filter: valid
new OmLCFilter.Builder().setTag(null, null).build(); // Tag without key or
value: invalid
```
Without `tagSet`, `(tagKey == null) != (tagValue == null)` would treat
both cases as an empty filter.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]