[ https://issues.apache.org/jira/browse/XALANJ-2584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mukul Gandhi updated XALANJ-2584: --------------------------------- Component/s: Xalan-interpretive XSLTC (was: Xalan) > 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-interpretive, XSLTC > Affects Versions: 2.7.1, 2.7.2 > Reporter: Philip Miess > Assignee: Mukul Gandhi > Priority: Minor > Fix For: 2.7.3 > > > 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 (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org For additional commands, e-mail: dev-h...@xalan.apache.org