Makes negative bytes size values deprecated
Negative bytes size values need to be deprecated in 6.x and throw an error in master (already done) since we supported them (jn error) up to 6.2.0 to maintain bwc.
@@ -64,7 +64,9 @@ public class ByteSizeValue implements Writeable, Comparable<ByteSizeValue> {
public ByteSizeValue(long size, ByteSizeUnit unit) {
if (size < -1 || (size == -1 && unit != ByteSizeUnit.BYTES)) {
- throw new IllegalArgumentException("Values less than -1 bytes are not supported: " + size + unit.getSuffix());
+ DEPRECATION_LOGGER.deprecated(
+ "Values less than -1 bytes are not deprecated and will not be supported in the next major version: [{}]",
+ size + unit.getSuffix());
}
if (size > Long.MAX_VALUE / unit.toBytes(1)) {
throw new IllegalArgumentException(
