Fix length check text on manual payout tool

This commit is contained in:
BtcContributor 2021-02-23 15:41:30 +01:00
parent 314e6ce314
commit 6edb318236
No known key found for this signature in database
GPG Key ID: DA582457496C7F6D
3 changed files with 5 additions and 1 deletions

View File

@ -3624,6 +3624,7 @@ validation.inputTooSmall=Input has to be larger than {0}
validation.inputToBeAtLeast=Input has to be at least {0} validation.inputToBeAtLeast=Input has to be at least {0}
validation.amountBelowDust=An amount below the dust limit of {0} satoshi is not allowed. validation.amountBelowDust=An amount below the dust limit of {0} satoshi is not allowed.
validation.length=Length must be between {0} and {1} validation.length=Length must be between {0} and {1}
validation.fixedLength=Length must be {0}
validation.pattern=Input must be of format: {0} validation.pattern=Input must be of format: {0}
validation.noHexString=The input is not in HEX format. validation.noHexString=The input is not in HEX format.
validation.advancedCash.invalidFormat=Must be a valid email or wallet id of format: X000000000000 validation.advancedCash.invalidFormat=Must be a valid email or wallet id of format: X000000000000

View File

@ -21,6 +21,10 @@ public class LengthValidator extends InputValidator {
ValidationResult result = new ValidationResult(true); ValidationResult result = new ValidationResult(true);
int length = (input == null) ? 0 : input.length(); int length = (input == null) ? 0 : input.length();
if (this.minLength == this.maxLength) {
if (length != this.minLength)
result = new ValidationResult(false, Res.get("validation.fixedLength", this.minLength));
} else
if (length < this.minLength || length > this.maxLength) if (length < this.minLength || length > this.maxLength)
result = new ValidationResult(false, Res.get("validation.length", this.minLength, this.maxLength)); result = new ValidationResult(false, Res.get("validation.length", this.minLength, this.maxLength));

View File

@ -69,5 +69,4 @@ public class LengthValidatorTest {
assertFalse(validator2.validate(null).isValid); // too short assertFalse(validator2.validate(null).isValid); // too short
assertFalse(validator2.validate("123456789").isValid); // too long assertFalse(validator2.validate("123456789").isValid); // too long
} }
} }