You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by xa...@xml.apache.org on 2004/10/21 17:44:13 UTC

[jira] Resolved: (XALANJ-1708) The number() function fails

Message:

   The following issue has been resolved as FIXED.

   Resolver: Christine Li
       Date: Thu, 21 Oct 2004 8:42 AM

Patch is applied. Please verify
---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XALANJ-1708

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XALANJ-1708
    Summary: The number() function fails
       Type: Bug

     Status: Resolved
 Resolution: FIXED

    Project: XalanJ2
 Components: 
             XPath
   Fix Fors:
             CurrentCVS
   Versions:
             2.5

   Assignee: 
   Reporter: David Perez

    Created: Thu, 30 Oct 2003 10:20 AM
    Updated: Thu, 21 Oct 2004 8:42 AM
Environment: Operating System: All
Platform: Other

Description:
For example if we try number('   ') (all spaces), the following happens:

  public double toDouble()
  {
      if(m_length == 0)
        return Double.NaN;
      int i;
      char c;
      String valueString = fsb().getString(m_start,m_length);
      
      for (i=0;i<m_length;i++)
        if (!XMLCharacterRecognizer.isWhiteSpace(valueString.charAt(i)))
          break;
      if (valueString.charAt(i) == '-')  
            <---------Fails here with a StringIndexOutOfBoundsException
        i++;
      .....

  }


An easy solution is to catch the StringIndexOutOfBoundsException and return in
that case Double.NaN.

Note: this error has been detected in version 2.5.1, but appears to be also in 2.5.2


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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