Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#25 NullPointer on connection closed

closed-fixed
None
5
2009-12-17
2009-12-14
Anonymous
No

Hi,

I'm using the virtuoso opensource 5.0.13-rc1 under Linux, I encountered a NullPointerException instead of a SQLException (ie VirtuosoException) when I execute the attached Java file.

Here is the test :
- Create XADataSource and start a 2PC transaction.
- Shutdown the virtuoso server to force a SQLException (Connection closed)
- execute a request (Instead of a SQLException a NullPointer occurs)

The error comes from the ConnectionWrapper Object.
Here is a diff result which fix this issue :

--- virtuoso/jdbc2/ConnectionWrapper.java 2009-12-14 11:10:00.000000000 +0100
+++ ConnectionWrapper.java 2009-12-14 11:10:48.000000000 +0100
@@ -840,14 +840,15 @@
pconn.sendErrorEvent(ex);

int vendor = ex.getErrorCode();
- if (vendor == VirtuosoException.DISCONNECTED
+ if ((vendor == VirtuosoException.DISCONNECTED
|| vendor == VirtuosoException.IOERROR
|| vendor == VirtuosoException.BADLOGIN
|| vendor == VirtuosoException.BADTAG
|| vendor == VirtuosoException.CLOSED
|| vendor == VirtuosoException.EOF
|| vendor == VirtuosoException.NOLICENCE
- || vendor == VirtuosoException.UNKNOWN)
+ || vendor == VirtuosoException.UNKNOWN) && pconn != null )
+
pconn.sendErrorEvent(ex);

}

Regards,
Eric

Discussion

    • assigned_to: nobody --> smalinin
     
  • Sergey Malinin
    Sergey Malinin
    2009-12-17

    Fixed

     
  • Sergey Malinin
    Sergey Malinin
    2009-12-17

    • status: open --> closed-fixed