[
https://issues.apache.org/jira/browse/NIFI-14509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17948911#comment-17948911
]
David Handermann commented on NIFI-14509:
-----------------------------------------
Thanks for asking [~dstiegli1]. This is an interesting case that can occur with
any other component that uses Expression Language. Handling it in ExcelReader
would require additional formatting checks in the method that retrieves the
starting row.
Falling back to the default value of the Starting Row property of 1 is an
interesting option, but that could actually be a negative as it would silently
alter behavior of the Reader. Configuring component properties with Expression
Language presents a certain level of risk, which the flow designer acknowledges
by configuring an expression. If the flow configuration can lead to FlowFiles
that do not contain the expected `startRow` attribute, or other attribute that
drives the expression, this is a configuration problem.
Under the circumstances, I think the current behavior is the best approach. It
may be worth evaluating the property handling for asInteger() to provide an
error message that includes the property name. However, silently falling back
to the default value does not seem like the best option for now.
> ExcelReader - Starting Row default value
> ----------------------------------------
>
> Key: NIFI-14509
> URL: https://issues.apache.org/jira/browse/NIFI-14509
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Affects Versions: 2.3.0
> Reporter: Philipp Korniets
> Priority: Minor
> Attachments: image-2025-05-02-14-39-18-581.png
>
>
> If Starting Row in Excel reader is set to use flowfile attribute (i.e.
> ${startRow}) and attribute is missing ExcelReader throws an error message
> {code:java}
> java.lang.NumberFormatException: For input string: ""
> at
> java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
> at java.base/java.lang.Integer.parseInt(Integer.java:672)
> at java.base/java.lang.Integer.parseInt(Integer.java:778)
> at
> org.apache.nifi.attribute.expression.language.StandardPropertyValue.asInteger(StandardPropertyValue.java:88){code}
> Of course we can use
> {code:java}
> ${startRow:isNull():ifElse(1,${startRow})}{code}
> But it would be nice to go back to defaults if attribute is missing.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)