ctubbsii commented on code in PR #6163:
URL: https://github.com/apache/accumulo/pull/6163#discussion_r2874337008
##########
core/src/main/java/org/apache/accumulo/core/data/constraints/DefaultKeySizeConstraint.java:
##########
@@ -44,21 +44,20 @@ public class DefaultKeySizeConstraint implements Constraint
{
@Override
public String getViolationDescription(short violationCode) {
- if (violationCode == MAX__KEY_SIZE_EXCEEDED_VIOLATION) {
- return "Key was larger than 1MB";
+ switch (violationCode) {
+ case MAX__KEY_SIZE_EXCEEDED_VIOLATION:
+ return "Key was larger than 1MB";
}
- return null;
+ return null;
}
- static final List<Short> NO_VIOLATIONS = new ArrayList<>();
-
@Override
public List<Short> check(Environment env, Mutation mutation) {
// fast size check
if (mutation.numBytes() < maxSize) {
- return NO_VIOLATIONS;
+ return null;
Review Comment:
This is a change in behavior, which I think we should probably try to avoid,
unless... is null documented as a special case?
Alternatively, could replace this with an unmodifiable or immutable list.
--
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]