mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-01 10:26:47 +00:00
Allow range validators to accept 64-bit min/max values
This commit is contained in:
1 parent
8d8a2a5583
commit
1fb6d23500
3 files changed
+5
-5
No files matched your search
@@ -5,7 +5,7 @@
|
||||
|
||||
package org.whispersystems.textsecuregcm.grpc.validators;
|
||||
|
||||
public record Range(int min, int max) {
|
||||
public record Range(long min, long max) {
|
||||
public Range {
|
||||
if (min > max) {
|
||||
throw new IllegalArgumentException("invalid range values: expected min <= max but have [%d, %d],".formatted(min, max));
|
||||
|
||||
+2
-2
@@ -39,8 +39,8 @@ public class RangeFieldValidator extends BaseFieldValidator<Range> {
|
||||
@Override
|
||||
protected Range resolveExtensionValue(final Object extensionValue) throws StatusException {
|
||||
final ValueRangeConstraint rangeConstraint = (ValueRangeConstraint) extensionValue;
|
||||
final int min = rangeConstraint.hasMin() ? rangeConstraint.getMin() : Integer.MIN_VALUE;
|
||||
final int max = rangeConstraint.hasMax() ? rangeConstraint.getMax() : Integer.MAX_VALUE;
|
||||
final long min = rangeConstraint.hasMin() ? rangeConstraint.getMin() : Long.MIN_VALUE;
|
||||
final long max = rangeConstraint.hasMax() ? rangeConstraint.getMax() : Long.MAX_VALUE;
|
||||
return new Range(min, max);
|
||||
}
|
||||
|
||||
|
||||
@@ -149,8 +149,8 @@ message SizeConstraint {
|
||||
}
|
||||
|
||||
message ValueRangeConstraint {
|
||||
optional int32 min = 1;
|
||||
optional int32 max = 2;
|
||||
optional int64 min = 1;
|
||||
optional int64 max = 2;
|
||||
}
|
||||
|
||||
extend google.protobuf.ServiceOptions {
|
||||
|
||||
Reference in new issue
Block a user