[
https://issues.apache.org/jira/browse/DAFFODIL-1651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17686511#comment-17686511
]
Steve Lawrence commented on DAFFODIL-1651:
------------------------------------------
Yeah, at expression evaluation time there probably isn't enough information to
improve the error. What we probably want to do add a check at schema
compilation time if an expression references an array so we get an SDE instead
of some runtime failure.
The {{NamedStep}} class in Expression.scala is maybe where to start looking
since that is what creates those DownArray* instances. That code already has
logic for checking if a downward step references just an array and errors. I
think maybe the bug is that it shouldn't be falling into the DownArrayExists
condition? Which I think means the contentLength function must have a
targetType of NodeInfo.Exists? I'm not sure why that would be the case? Maybe
the targetType of ContentLengthExpr is wrong? I'm not sure, but those would be
places to start looking.
> Unparse: dfdl:content/valueLength of an Array returns unexpected result
> -----------------------------------------------------------------------
>
> Key: DAFFODIL-1651
> URL: https://issues.apache.org/jira/browse/DAFFODIL-1651
> Project: Daffodil
> Issue Type: Bug
> Components: General, Unparsing
> Affects Versions: 2.0.0
> Reporter: Steve Lawrence
> Assignee: Mike McGann
> Priority: Major
> Fix For: 3.5.0
>
>
> When trying to get the dfdl:contentLength of dfdl:valueLength of an array,
> Daffodil returns the length of it's parent, rather than the array. This is
> because the NodeType.Exists parameter type ends up creating a DownArrayExists
> recipe, which does not change the current node. Either we need to disallow
> getting the content/valueLength of an array and require the user to wrap the
> array in a complex type, or we need to allow it and modify/add parsers to
> store value/contentLength of an array.
> Alternatively, we maybe be able to do some magic where we get the start pos
> of the first child and the end pos of the last child and return that length.
> It's not immeidately clear if that is correct.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)