[Monetdb-developers] Workaround for JDK6 Bug 6795561
Howdy, When using the MonetDB JDBC driver on JDK6 (or JRE6) > 6.10 you will get IndexOutOfBoundsExceptions when using transactions (possibly in other cases as well). This happens because there is a bug in CharBuffer.subSequence(), which is used in StartOfHeaderParser.java The following patch remedies this problem, without any regressions as far as I can tell. Recompiling the JDBC driver is all that's required. You'll still have to compile with the 1.5 option because the JDBC interface changed quite a bit between 5 and 6, but if I have time left I might fix that as well. Hope this'll help someone. --- MonetDB-java/java/src/nl/cwi/monetdb/mcl/parser/StartOfHeaderParser.java Wed Mar 04 12:21:50 2009 +++ MonetDB-java/java/src/nl/cwi/monetdb/mcl/parser/StartOfHeaderParser.java Thu May 07 11:57:47 2009 @@ -141,8 +141,7 @@ while (soh.hasRemaining() && soh.get() != ' ') { cnt++; } - soh.reset(); - return(soh.subSequence(0, cnt).toString()); + return(soh.slice().subSequence(0, cnt).toString()); } }
Hi Bram, On 07-05-2009 12:51:51 +0200, Bram Van Dam wrote:
When using the MonetDB JDBC driver on JDK6 (or JRE6) > 6.10 you will get IndexOutOfBoundsExceptions when using transactions (possibly in other cases as well). This happens because there is a bug in CharBuffer.subSequence(), which is used in StartOfHeaderParser.java
The following patch remedies this problem, without any regressions as far as I can tell. Recompiling the JDBC driver is all that's required.
Thanks!
You'll still have to compile with the 1.5 option because the JDBC interface changed quite a bit between 5 and 6, but if I have time left I might fix that as well.
Hope this'll help someone.
Do you have any idea what this performance wise does to the driver? (I don't at the moment.)
Fabian Groffen wrote:
Do you have any idea what this performance wise does to the driver? (I don't at the moment.)
I don't at the moment either. Haven't had a chance to take an in-depth look at it. It is possible to make the slice() operation conditional. The bug report states "Works OK as long as absolute end index is <= remaining()", so I suppose we could check for this condition. Might be less of a performance hit than calling slice() every time. - Bram
participants (3)
-
Bram Van Dam
-
Bram Van Dam
-
Fabian Groffen