Re: unpredictable behavior

From: Kris Jurka <books(at)ejurka(dot)com>
To: Nadeem Bitar <nadiizu(at)earthlink(dot)net>
Cc: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: unpredictable behavior
Date: 2004-02-06 21:54:36
Message-ID: Pine.LNX.4.33.0402061549550.5426-200000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Thu, 5 Feb 2004, Nadeem Bitar wrote:

> I am running postgresql 7.3 on fedora core1. The database encoding is
> euc-jp.
> I have unit tests that test my persistence code what is troubling is
> that the tests fail with the exception listed below but if I rerun the
> same tests they pass. Out of 10 runs, 8 would pass and 2 would fail.
> Any idea why the behavior is not consistent? I would rather that they
> always fail.
>
> End of Stack Trace
> [junit] ]; nested exception is:
> [junit] Something unusual has occured to cause the driver to
> fail. Please report this exception: Exception: java.lang.
> IllegalArgumentException
> [junit] Stack Trace:
>
> [junit] java.lang.IllegalArgumentException
> [junit] at java.nio.Buffer.position(Buffer.java:218)
> [junit] at java.nio.charset.CharsetDecoder.decode
> (CharsetDecoder.java:575)
> [junit] at java.lang.StringCoding$CharsetSD.decode(StringCoding.
> java:186)
> [junit] at java.lang.StringCoding.decode(StringCoding.java:224)
> [junit] at java.lang.StringCoding.decode(StringCoding.java:230)
> [junit] at java.lang.String.<init>(String.java:371)
> [junit] at org.postgresql.jdbc1.AbstractJdbc1Connection.
> openConnection(AbstractJdbc1Connection.java:226)
> [junit] at org.postgresql.Driver.connect(Driver.java:122)
>

I can see why this is failing, but I have not been able to duplicate it.
It is trying to turn the md5 salt into a String. The problem is that
random bytes don't always make a string depending on your encoding (which
I'd be interested to know.) I've attached a patch to the 7.4 driver which
I believe should fix this problem. I've also put a prebuilt version of
this up at

http://www.ejurka.com/pgsql/jars/pg74jdbc3-nadeem-bitar.jar

Please let me know your jvm encoding and if this fixes the problem.

Kris Jurka

Attachment Content-Type Size
md5string.patch text/plain 3.0 KB

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2004-02-07 17:12:53 Re: Postgresql 7.4.1 and JDBC setFetchSize
Previous Message Tammy Jones 2004-02-06 19:29:00 DbcpException: Backend Start-up Failed