Re: unpredictable behavior - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: unpredictable behavior
Date
Msg-id Pine.LNX.4.33.0402061549550.5426-200000@leary.csoft.net
Whole thread Raw
In response to unpredictable behavior  (Nadeem Bitar <nadiizu@earthlink.net>)
List 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

pgsql-jdbc by date:

Previous
From: Carlos Correia
Date:
Subject: Re: Problems with DatabaseMetaData.getImportedKeys
Next
From: curtis@stanfordcomputing.com (Curtis Stanford)
Date:
Subject: Re: Postgresql 7.4.1 and JDBC setFetchSize