java.lang.ArrayIndexOutOfBoundsException: 3
at org.postgresql.core.Encoding.decodeUTF8(Encoding.java:253)
at org.postgresql.core.Encoding.decode(Encoding.java:165)
at org.postgresql.core.Encoding.decode(Encoding.java:181)
at
org.postgresql.jdbc1.AbstractJdbc1ResultSet.getString(AbstractJdbc1ResultSet.java:97)
The relavent code is:
while (i < k) {
z = data[i] & 0xFF;
if (z < 0x80) {
l_cdata[j++] = (char)data[i];
i++;
} else if (z >= 0xE0) { // length == 3
y = data[i+1] & 0xFF; //<<== THIS IS LINE 253
x = data[i+2] & 0xFF;
val = (z-0xE0)*pow2_12 + (y-0x80)*pow2_6 + (x-0x80);
l_cdata[j++] = (char) val;
i+= 3;
} else { // length == 2 (maybe add checking for length > 3, throw exception if it is
And in the method that calls that:
if (encoding.equals("UTF-8")) {
return decodeUTF8(encodedString, offset, length);
}
The thing is my database encoding is SQL_ASCII
=> SELECT version(), getdatabaseencoding() ;
version
| getdatabaseencoding
---------------------------------------------------------------------------------------------------------+---------------------
PostgreSQL 7.3.1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.2 20020903 (Red Hat
Linux 8.0 3.2-7) | SQL_ASCII
(1 row)
... so why is it trying to decode the string as UTF-8? I just upgraded this database from
7.2.3 yesterday.
--
Joseph Shraibman
joseph@xtenit.com
Increase signal to noise ratio. http://xis.xtenit.com