mgaido91 commented on a change in pull request #3634: NIFI-6524 MergeContent
properties should accept expression language variables
URL: https://github.com/apache/nifi/pull/3634#discussion_r310459480
##########
File path:
nifi-nar-bundles/nifi-extension-utils/nifi-processor-utils/src/main/java/org/apache/nifi/processor/util/bin/BinFiles.java
##########
@@ -326,35 +341,104 @@ public final void onScheduled(final ProcessContext
context) throws IOException {
protected final Collection<ValidationResult> customValidate(final
ValidationContext context) {
final List<ValidationResult> problems = new
ArrayList<>(super.customValidate(context));
- final long minBytes =
context.getProperty(MIN_SIZE).asDataSize(DataUnit.B).longValue();
- final Double maxBytes =
context.getProperty(MAX_SIZE).asDataSize(DataUnit.B);
-
- if (maxBytes != null && maxBytes.longValue() < minBytes) {
- problems.add(
- new ValidationResult.Builder()
- .subject(MIN_SIZE.getName())
- .input(context.getProperty(MIN_SIZE).getValue())
- .valid(false)
- .explanation("Min Size must be less than or equal to Max
Size")
- .build()
- );
- }
-
- final Long min = context.getProperty(MIN_ENTRIES).asLong();
- final Long max = context.getProperty(MAX_ENTRIES).asLong();
+ final String minSize =
context.getProperty(MIN_SIZE).evaluateAttributeExpressions().getValue();
+ final String maxSize =
context.getProperty(MAX_SIZE).evaluateAttributeExpressions().getValue();
+ if(minSize != null || maxSize != null) {
+ // Keep track of valid formats in order to check their value only
if they pass the format validation
+ boolean minSizeValidFormat = false;
+ boolean maxSizeValidFormat = false;
+ if(minSize != null) {
+ if (!DATA_SIZE_PATTERN.matcher(minSize).matches()) { //
Validates both format and non-negativity
Review comment:
```suggestion
if (!DATA_SIZE_PATTERN.matcher(minSize).matches()) { //
Validates both format and non-negativity
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services