You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by ph...@thomsonreuters.com on 2014/04/30 21:13:17 UTC

FW: Date:Date throws IndexOutOfBounds Exception on empty input

xalan-dev,
	Following the procedure on the bug reporting page (http://xalan.apache.org/xalan-j/bugreporting.html), 
I sent the following request about a possible bug to the j-users list for clarification. 
I have not received any reply to date.
If this is no longer the procedure, an update to that page is in order.

Would anyone care to comment about this potential bug on this list?

Thanks,
Philip Miess
_____________________________________________
From: Miess, Philip (TR Technology) 
Sent: Thursday, January 30, 2014 1:59 PM
To: 'j-users@xalan.apache.org'
Subject: Date:Date throws IndexOutOfBounds Exception on empty input


j-users,

When running the following XSL file Xalan-J 2.7.1 throws 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
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
"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.

<?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(@anAttribute)"/>
        </xsl:element>
    </xsl:template>
</xsl:stylesheet>

Is this a bug? Should I write it up?
Thanks,
Philip Miess



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