mirror of
https://github.com/apache/nifi.git
synced 2025-02-10 03:55:22 +00:00
NIFI-6281 Rename ISO8061_INSTANT_VALIDATOR to ISO8601_INSTANT_VALIDATOR
ISO8061_INSTANT_VALIDATOR was misnamed - the correct standard is ISO 8601. Also updated the error messages to have spaces in them, which is how the ISO site displays them. This closes #3465 Signed-off-by: Mike Thomsen <mikerthomsen@gmail.com>
This commit is contained in:
parent
7825e40d15
commit
595835f6ee
@ -273,18 +273,21 @@ public class StandardValidators {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Validator ISO8061_INSTANT_VALIDATOR = new Validator() {
|
public static final Validator ISO8601_INSTANT_VALIDATOR = new Validator() {
|
||||||
@Override
|
@Override
|
||||||
public ValidationResult validate(final String subject, final String input, final ValidationContext context) {
|
public ValidationResult validate(final String subject, final String input, final ValidationContext context) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Instant.parse(input);
|
Instant.parse(input);
|
||||||
return new ValidationResult.Builder().subject(subject).input(input).explanation("Valid ISO8061 Instant Date").valid(true).build();
|
return new ValidationResult.Builder().subject(subject).input(input).explanation("Valid ISO 8601 Instant Date").valid(true).build();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
return new ValidationResult.Builder().subject(subject).input(input).explanation("Not a valid ISO8061 Instant Date, please enter in UTC time").valid(false).build();
|
return new ValidationResult.Builder().subject(subject).input(input).explanation("Not a valid ISO 8601 Instant Date, please enter in UTC time").valid(false).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// Old name retained for compatibility
|
||||||
|
@Deprecated
|
||||||
|
public static final Validator ISO8061_INSTANT_VALIDATOR = ISO8601_INSTANT_VALIDATOR;
|
||||||
|
|
||||||
public static final Validator NON_NEGATIVE_INTEGER_VALIDATOR = new Validator() {
|
public static final Validator NON_NEGATIVE_INTEGER_VALIDATOR = new Validator() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user