You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Carlo Marchiori (JIRA)" <xa...@xml.apache.org> on 2004/11/15 15:30:23 UTC

[jira] Commented: (XALANJ-1991) StackOverflowException comparing two strings

     [ http://nagoya.apache.org/jira/browse/XALANJ-1991?page=comments#action_55497 ]
     
Carlo Marchiori commented on XALANJ-1991:
-----------------------------------------

Proposed fix.

The problem is with the class org.apache.xpath.objects.XMLString

and in particular with the method

---------------------------------------
  public boolean equals(XMLString obj2)
  {
      if (!obj2.hasString())
          return obj2.equals(this);
      else
          return str().equals(obj2.toString());
  }
-------------------------------------------

When both obj2 and this return false on 'hasString' and infinite loop occurs. So
my proposed fix is 

----------------------------------
  public boolean equals(XMLString obj2)
  {
//    if (!obj2.hasString())           
      if (!obj2.hasString() && this.hasString())
          return obj2.equals(this);
      else
          return str().equals(obj2.toString());
  }
-------------------------------------

> StackOverflowException comparing two strings
> --------------------------------------------
>
>          Key: XALANJ-1991
>          URL: http://nagoya.apache.org/jira/browse/XALANJ-1991
>      Project: XalanJ2
>         Type: Bug
>   Components: Xalan
>     Versions: 2.4, 2.5Dx, 2.5, 2.6
>  Environment: Any
>     Reporter: Carlo Marchiori
>  Attachments: XALANJ-1991-usecase.zip
>
> java.lang.StackOverflowError
> 	at org.apache.xpath.objects.XStringForChars.hasString(XStringForChars.java:97)
> 	at org.apache.xpath.objects.XString.equals(XString.java:401)
> 	at org.apache.xpath.objects.XString.equals(XString.java:402)
> 	at org.apache.xpath.objects.XString.equals(XString.java:402)
> 	at org.apache.xpath.objects.XString.equals(XString.java:402)
> 	at org.apache.xpath.objects.XString.equals(XString.java:402)
> .......

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.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