You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Mukul Gandhi (JIRA)" <ji...@apache.org> on 2019/05/29 09:55:00 UTC

[jira] [Commented] (XALANJ-2584) EXSLT function Date:Date throws IndexOutOfBounds Exception on empty input

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

Mukul Gandhi commented on XALANJ-2584:
--------------------------------------

committed fix for this, to the Xalan GitBox repos https://gitbox.apache.org/repos/asf/xalan-java.git (branch xalan-j_2_7_1_maint)

> EXSLT function Date:Date throws IndexOutOfBounds Exception on empty input
> -------------------------------------------------------------------------
>
>                 Key: XALANJ-2584
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2584
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects.  Anybody can view the issue.) 
>          Components: Xalan
>    Affects Versions: 2.7.2
>            Reporter: Philip Miess
>            Assignee: Steven J. Hathaway
>            Priority: Minor
>
> When running the following XSL file Xalan-J throws 
> bq. java.lang.StringIndexOutOfBoundsException: String index out of range: 0 - String index out of range: 0
> As long as the root node does not have an attribute named "anAttribute".
> Expected output is an single root node
> [ExsltDatetime.html|https://xalan.apache.org/xalan-j/apidocs/org/apache/xalan/lib/ExsltDatetime.html#date(java.lang.String)] indicates that it should produce an empty string instead of throwing
> bq. If the argument is not in either of these formats, date:date returns an empty string ('')
> Saxon produces the expected output.
> If the null check where moved to the start of the date function it world work as specified.
> h4. The files used to reproduce this problem
> h5. The transform file
> {code:xml|title=Transform.xsl}
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:exsl="http://exslt.org"
>     xmlns:date="http://exslt.org/dates-and-times"
>     extension-element-prefixes="date exsl"
>     version="1.0">
>     <xsl:template match="/">
>         <xsl:element name="root">
>             <xsl:value-of select="date:date(root/@anAttribute)"/>
>         </xsl:element>
>     </xsl:template>
> </xsl:stylesheet>
> {code}
> h5. An input file that works
> {code:xml|title=InputSuccess.xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <root anAttribute="present"/>
> {code}
> h5. An input file that causes an StringIndexOutOfBoundsException
> {code:xml|title=InputFailure.xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <root />
> {code}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xalan.apache.org
For additional commands, e-mail: dev-help@xalan.apache.org