ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "adamb (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Commented: (IBATIS-338) NestedSqlException stack overflow
Date Wed, 30 Aug 2006 20:54:22 GMT
    [ http://issues.apache.org/jira/browse/IBATIS-338?page=comments#action_12431686 ] 
            
adamb commented on IBATIS-338:
------------------------------

Looking at the 2.2.0 source it still has the problem:

  public String toString() {
    if (cause == null) {
      return super.toString();
    } else {
      return super.toString() + CAUSED_BY + cause.toString();
    }
  }

if the NestedSqlException is constructed with a throwable that has a cause==this (at any cause
depth) then the toString will infinitely recurse until stack overflow.

the java API doesn't guarantee that the Throwable cause will not be the same exception (or
more disturbingly one of its own parents).

I will look at putting a 'fixed' version of NestedSqlException on our classpath so I can try
to find out what throwable is being given to the constructor of the nested sql exception.
 (Unfortunately I'm unable to replicate this issue in development, and there is about a ~2week
cycle to systems test where they can replicate the issue).

> NestedSqlException stack overflow
> ---------------------------------
>
>                 Key: IBATIS-338
>                 URL: http://issues.apache.org/jira/browse/IBATIS-338
>             Project: iBatis for Java
>          Issue Type: Bug
>    Affects Versions: 2.1.5
>            Reporter: adamb
>
> ...
> at com.ibatis.common.jdbc.exception.NestedSQLException.toString(NestedSQLException.java:113)
> at com.ibatis.common.jdbc.exception.NestedSQLException.toString(NestedSQLException.java:113)
> ...
> In the code you can see that if cause==this then the NestedSqlException.toString() method
will infinitely recurse causing a stack overflow.  I'm not sure what is causeing (cause==this)
to be set to this though...

-- 
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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message