You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by "Steve Lawrence (JIRA)" <ji...@apache.org> on 2018/07/19 18:20:00 UTC

[jira] [Commented] (DAFFODIL-1969) Exception on unparse of string with fixed length

    [ https://issues.apache.org/jira/browse/DAFFODIL-1969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16549649#comment-16549649 ] 

Steve Lawrence commented on DAFFODIL-1969:
------------------------------------------

Thanks for providing the test files, this really helps us alot.

It looks like the issue is that we do no handle padding/truncation correctly when unparsing with the combination of dfdl:lengthKind="explicit" and dfdl:truncateSpecifiedLength="yes" when the length of the data in the infoset is less than the explicit length. In that case don't realize the string doesn't need to be truncated but try to truncate it anyway, and end up going out of bounds.

A temporary workaround to get things unparsing is to set the truncateSpecifiedLength property to "no". With that set, if the data in your infoset is longer than the explicit length then you will get an SDE instead of truncation.

> Exception on unparse of string with fixed length
> ------------------------------------------------
>
>                 Key: DAFFODIL-1969
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-1969
>             Project: Daffodil
>          Issue Type: Bug
>          Components: DFDL Schemas
>    Affects Versions: 2.1.0
>         Environment: Windows 7, Daffodil 2.1.0
>            Reporter: James L Welch
>            Priority: Minor
>             Fix For: 2.2.0
>
>         Attachments: AppTable.xml, TFconfigSYS.dfdl.xsl, appTable.cfg, u.bat
>
>
> java.lang.StringIndexOutOfBoundsException: String index out of range: 64
>  <xs:element name="AppParms" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="64" dfdl:textOutputMinLength="64" />
>  Removed dfdl:textOutputMinLength - same error
> Attached file AppTable.cfg is the original binary file {color:#FF0000}parsed{color} into AppTable.xml
> Unparsing gives exception on first AppParms element



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)