From: | Mats Lofkvist <mal(at)algonet(dot)se> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org |
Subject: | JDBC access broken in 7.3 beta |
Date: | 2002-11-08 15:21:14 |
Message-ID: | y2qadkkf5p1.fsf@algonet.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The optimization added in
src/interfaces/jdbc/org/postgresql/core/Encoding.java
version 1.7 breaks JDBC since it is not thread safe.
The new method decodeUTF8() uses a static (i.e. class member)
but is synchronized on the instance so it won't work with multiple
instances used in parallel by multiple threads.
(Quick and dirty patch below.)
(The method also isn't using the 'length' parameter correctly,
but since offset always seems to be zero, this bug doesn't show up.)
_
Mats Lofkvist
mal(at)algonet(dot)se
*** org/postgresql/core/Encoding.java~ Sun Oct 20 04:55:50 2002
--- org/postgresql/core/Encoding.java Fri Nov 8 16:13:20 2002
***************
*** 233,239 ****
*/
private static final int pow2_6 = 64; // 26
private static final int pow2_12 = 4096; // 212
! private static char[] cdata = new char[50];
private synchronized String decodeUTF8(byte data[], int offset, int length) {
char[] l_cdata = cdata;
--- 233,239 ----
*/
private static final int pow2_6 = 64; // 26
private static final int pow2_12 = 4096; // 212
! private char[] cdata = new char[50];
private synchronized String decodeUTF8(byte data[], int offset, int length) {
char[] l_cdata = cdata;
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-11-09 15:41:14 | Re: I can't start postgres anymore |
Previous Message | elein | 2002-11-08 03:11:29 | Re: Cannot assign ROWTYPE, RECORD variables in PL/pgSQL |