DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7145>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7145 sql lib: empty query result cause exception and leave db connection open Summary: sql lib: empty query result cause exception and leave db connection open Product: XalanJ2 Version: CurrentCVS Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: org.apache.xalan.lib.sql AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] 1. sql queries that produce zero output rows causes a null pointer exception if streaming mode is active. 2. a subsequent error: the database connection isn't closed if the bug above occurs, resulting in many open hanging database connections. It's a problem of its own, since other bugs also can cause hanging connections. bug 1: around line 683 in SQLDocument.java the member variable m_LastRowIdx = -1 and the setElementAt throws a null pointer exception if the query has produced no result rows if (m_StreamingMode) { // We are at the end, so let's untie the mark m_nextsib.setElementAt(DTM.NULL, m_LastRowIdx); } I tried the following fix and it worked, but I`m not quite sure whether this is the correct fix if (m_StreamingMode && (m_LastRowIdx!=-1)) bug 2: in the method 'query' in XConnection.java (around line 700) the following code fragment doesn't close the connection for the null pointer exception above catch (Exception e) { if ((doc != null) && (mgrDefault != null)) { doc.closeOnError(); mgrDefault.release(doc, true); } if (DEBUG) System.out.println("exception in query()"); buildErrorDocument(exprContext, e); return null; } I added an additional try { if (null != con) m_ConnectionPool.releaseConnectionOnError(con); } catch(Exception e1) { } that solved the problem of open hanging connections. Even if bug 1 does not occur, maybe other errors cause bug 2 to occur, resulting in hanging connections Klemens
