Thread: Bug found in the driver

Bug found in the driver

From
Denis Bucher
Date:
Hello !

I wrote the following message on 16 July, 26 July and 2nd of august without any
answer but at last someone told me I should post my mail here !

http://groups.google.com/groups?hl=en&safe=off&th=dc3d93bb1b568bcd,1
http://groups.google.com/groups?hl=en&safe=off&th=333d8b98593550b7,1

I hope it will be the right place to correct the bug :-)

Please look at message number 1 in the P.S.

Denis Bucher


P.S. MESSAGE 1:
From: Denis BUCHER (dbucher@horus.ch)
Subject: Bug found in driver ! (JDBC postgresql driver)
Newsgroups: comp.databases.postgresql.interfaces.jdbc
Date: 2001-07-16 06:10:24 PST
Hello !

I've FOUND A BUG in the postgres JDBC driver !

If you want to see the source online :
http://cs.baylor.edu/~speegle/5335/org/postgresql/

Please look at Driver.class :

     } catch(Exception ex2) {
         throw new PSQLException("postgresql.unusual",ex2);

But it doesn't print the exception ex2 !!!  I am not an enough
good Java programmer to understand why, but I've found how
to circumvent it :

     } catch(Exception ex2) {
         throw new PSQLException("Unexpected exception : " + ex2);

Now :

  --> Is someone able to CORRECT THE BUG ?


Thanks a lot !

Denis Bucher


MESSAGE 2:

From: Denis BUCHER (dbucher@horus.ch)
Subject: BUG - NOT ANSWERED
Newsgroups: comp.databases.postgresql.interfaces.jdbc
Date: 2001-07-26 03:56:31 PST
Hello !

On 16 jul 2001,
I send a message named "Bug found in driver ! (JDBC postgresql driver)"
but it seems that it got no reaction, may I therefore suppose that JDBC
driver for postgresql is *ABANDONNED* and noone is taking care of this
piece of software ?

Thanks a lot in advance !

Denis


Re: Bug found in the driver

From
Rene Pijlman
Date:
On Fri, 03 Aug 2001 15:06:46 +0200, Denis Bucher wrote:
>I've FOUND A BUG in the postgres JDBC driver !

OK, please help us fix it.

>If you want to see the source online :
>http://cs.baylor.edu/~speegle/5335/org/postgresql/
>
>Please look at Driver.class :
>
>     } catch(Exception ex2) {
>         throw new PSQLException("postgresql.unusual",ex2);
>
>But it doesn't print the exception ex2 !!!

This code is not supposed to print an exception. Please be more
specific. What are you doing exactly? Why are we looking at this
particular line of source code? What exception did you expect?
Why did you expect it to be printed?

Regards,
René Pijlman

Re: Bug found in the driver

From
Denis Bucher
Date:
At 22:01 03.08.01 +0200, you wrote:

Hello !

>On Fri, 03 Aug 2001 15:06:46 +0200, Denis Bucher wrote:
> >I've FOUND A BUG in the postgres JDBC driver !
>
>OK, please help us fix it.
>
> >If you want to see the source online :
> >http://cs.baylor.edu/~speegle/5335/org/postgresql/
> >
> >Please look at Driver.class :
> >
> >     } catch(Exception ex2) {
> >         throw new PSQLException("postgresql.unusual",ex2);
> >
> >But it doesn't print the exception ex2 !!!
>
>This code is not supposed to print an exception. Please be more
>specific. What are you doing exactly? Why are we looking at this
>particular line of source code? What exception did you expect?
>Why did you expect it to be printed?

Ok, this line prints the following message :

Quelque chose de peu commun s'est produit pour faire échouer le
gestionnaire. Veuillez enregistrer cette exception: {0}

which is the french version of :

Something unusual has occured to cause the driver to fail.
Please report this exception: {0}

BUT it doesn't print the exception between '{' and '}' which makes
VERY hard to debug the problem. I found LOTS of emails in
mailing-lists only due to this problem : If the exception was
printed, people wouldn't have asked because they would have
seen "this host is not present in hba_conf", or something like
that. With my 'kludge-correction' it PRINTS the EXACT exception
that made the driver fail :

throw new PSQLException("postgresql.unusual: " + ex2);

But I know my correction isn't 'clean' because it circumvents the
PSQLException method that IMHO SHOULD print out the exception,
or else why the hell would there be that message "please report this
exception : {0}" AND why whould 'ex2' be mentionned ?

Denis


Re: Bug found in the driver

From
Denis Bucher
Date:
At 22:01 03.08.01 +0200, Rene Pijlman wrote:
>On Fri, 03 Aug 2001 15:06:46 +0200, Denis Bucher wrote:
> >I've FOUND A BUG in the postgres JDBC driver !
>
>OK, please help us fix it.
>
> >If you want to see the source online :
> >http://cs.baylor.edu/~speegle/5335/org/postgresql/
> >
> >Please look at Driver.class :
> >
> >     } catch(Exception ex2) {
> >         throw new PSQLException("postgresql.unusual",ex2);
> >
> >But it doesn't print the exception ex2 !!!
>
>This code is not supposed to print an exception. Please be more
>specific. What are you doing exactly? Why are we looking at this
>particular line of source code? What exception did you expect?
>Why did you expect it to be printed?

And in brief :

When there is an unexpected exception like "host not found in hba_conf",
the driver throws this "postgres.unusual" exception.

This exception is in the "errors.properties" file, and the exception SHOULD
be printed for two reasons : 1. in the source, "ex2" is specified, and 2. the
error tells us "to record the following exception"

And a lot of people post to mailing-lists because the exception is not printed,
if it was people wouldn't ask, because the text would be clear enough to them.

Therefore, it seems there is a bug (the exception is not printed) and even
if this
wasn't the aim, the exception SHOULD be printed because it would help people
a lot debbuging their applications...

Denis


Re: Bug found in the driver

From
Steve Wampler
Date:
Denis Bucher wrote:
>
> At 22:01 03.08.01 +0200, Rene Pijlman wrote:
> >On Fri, 03 Aug 2001 15:06:46 +0200, Denis Bucher wrote:
> > >I've FOUND A BUG in the postgres JDBC driver !
> >
> >OK, please help us fix it.
> >
> > >If you want to see the source online :
> > >http://cs.baylor.edu/~speegle/5335/org/postgresql/
> > >
> > >Please look at Driver.class :
> > >
> > >     } catch(Exception ex2) {
> > >         throw new PSQLException("postgresql.unusual",ex2);
> > >
> > >But it doesn't print the exception ex2 !!!
> >
> >This code is not supposed to print an exception. Please be more
> >specific. What are you doing exactly? Why are we looking at this
> >particular line of source code? What exception did you expect?
> >Why did you expect it to be printed?
>
> And in brief :
>
> When there is an unexpected exception like "host not found in hba_conf",
> the driver throws this "postgres.unusual" exception.
>
> This exception is in the "errors.properties" file, and the exception SHOULD
> be printed for two reasons : 1. in the source, "ex2" is specified, and 2. the
> error tells us "to record the following exception"
>
> And a lot of people post to mailing-lists because the exception is not printed,
> if it was people wouldn't ask, because the text would be clear enough to them.
>
> Therefore, it seems there is a bug (the exception is not printed) and even
> if this
> wasn't the aim, the exception SHOULD be printed because it would help people
> a lot debbuging their applications...

I don't agree that the above code should print the exception.  It seems to
me that the above code is correct in simply throwing the exception.  It's
where the exception is *caught* that things go wrong.  At that point, whatever
prints the *name* of the exception should also print the *message*, and isn't.  Now,
it may well be that PSQLException() isn't implementing toString() properly and is
the real culprit...

In short, yes, there's probably a bug, but it's not at this point in the code...
--
Steve Wampler-  SOLIS Project, National Solar Observatory
swampler@noao.edu

Re: Bug found in the driver

From
Denis Bucher
Date:
At 11:07 07.08.01 -0700, you wrote:

Hello !

> > I agree with you. But is there someone that could find the exact place to
> > correct it ? This would be nice... And it would spare some time in the
> > mailling-lists, just do a google.com search at "unusual" and you'll see
> ;-))
>
>I thought I'd take more of a look at this (because I don't want to do the
>work I'm supposed to be doing!).  It looks for all the world to me that
>the code is correct and that somehow MessageFormat.format() isn't working
>properly.  This is, of course, unlikely, since I'm pretty sure Sun has
>tested MessageFormat quite a bit!
>
>Do you have a simple test case I can run that will show the problem?
>There's not much I can do without being able to reproduce the problem.

It is very easy to reproduce the bug !

Just change you pg_hba.conf so that the host on which you are has
got no entry. And you'll see :

Instead of saying "unusual error, please record the following exception :
No pg_hba.conf entry for host 192.168.200.4, user postgres database
test" (or something like that) it will say only :

"unusual error, please record the following exception : {0}"

Denis



RE: Bug found in the driver

From
"Dave Cramer"
Date:
Denis,

Do you get this error with current binaries from

http://jdbc.fastcrypt.com

Regards,

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Denis Bucher
Sent: August 8, 2001 7:44 AM
To: Steve Wampler
Cc: PGSQL-JDBC
Subject: Re: [JDBC] Bug found in the driver


At 11:07 07.08.01 -0700, you wrote:

Hello !

> > I agree with you. But is there someone that could find the exact
> > place to correct it ? This would be nice... And it would spare some
> > time in the mailling-lists, just do a google.com search at "unusual"

> > and you'll see
> ;-))
>
>I thought I'd take more of a look at this (because I don't want to do
>the work I'm supposed to be doing!).  It looks for all the world to me
>that the code is correct and that somehow MessageFormat.format() isn't
>working properly.  This is, of course, unlikely, since I'm pretty sure
>Sun has tested MessageFormat quite a bit!
>
>Do you have a simple test case I can run that will show the problem?
>There's not much I can do without being able to reproduce the problem.

It is very easy to reproduce the bug !

Just change you pg_hba.conf so that the host on which you are has got no
entry. And you'll see :

Instead of saying "unusual error, please record the following exception
: No pg_hba.conf entry for host 192.168.200.4, user postgres database
test" (or something like that) it will say only :

"unusual error, please record the following exception : {0}"

Denis



---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



RE: Bug found in the driver

From
Denis Bucher
Date:
At 09:05 08.08.01 -0400, you wrote:
>Denis,
>
>Do you get this error with current binaries from
>http://jdbc.fastcrypt.com

Yes, with the latest binaries I get approximately :

EXCEPTION Quelque chose de peu commun sest produit pour faire ??chouer le
gestionnaire. Veuillez enregistrer cette exception: {0}

You can find it into : org/postgres/errors_fr.properties

With my modified/kludge version I get :

"... java.sql.SQLException: Password authentification failed for user 'test'"

Denis

>-----Original Message-----
>From: pgsql-jdbc-owner@postgresql.org
>[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Denis Bucher
>Sent: August 8, 2001 7:44 AM
>To: Steve Wampler
>Cc: PGSQL-JDBC
>Subject: Re: [JDBC] Bug found in the driver
>
>
>At 11:07 07.08.01 -0700, you wrote:
>
>Hello !
>
> > > I agree with you. But is there someone that could find the exact
> > > place to correct it ? This would be nice... And it would spare some
> > > time in the mailling-lists, just do a google.com search at "unusual"
>
> > > and you'll see
> > ;-))
> >
> >I thought I'd take more of a look at this (because I don't want to do
> >the work I'm supposed to be doing!).  It looks for all the world to me
> >that the code is correct and that somehow MessageFormat.format() isn't
> >working properly.  This is, of course, unlikely, since I'm pretty sure
> >Sun has tested MessageFormat quite a bit!
> >
> >Do you have a simple test case I can run that will show the problem?
> >There's not much I can do without being able to reproduce the problem.
>
>It is very easy to reproduce the bug !
>
>Just change you pg_hba.conf so that the host on which you are has got no
>entry. And you'll see :
>
>Instead of saying "unusual error, please record the following exception
>: No pg_hba.conf entry for host 192.168.200.4, user postgres database
>test" (or something like that) it will say only :
>
>"unusual error, please record the following exception : {0}"
>
>Denis
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/users-lounge/docs/faq.html
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/users-lounge/docs/faq.html


RE: Bug found in the driver

From
"Dave Cramer"
Date:
Denis,

Can you do me a favour, and post a small program which can reproduce
your results.
If you have already done so, let me know and I will go and find it.

Dave

-----Original Message-----
From: Denis Bucher [mailto:dbucher@niftycom.com]
Sent: August 8, 2001 9:56 AM
To: PGSQL-JDBC
Cc: Dave@micro-automation.net
Subject: RE: [JDBC] Bug found in the driver


At 09:05 08.08.01 -0400, you wrote:
>Denis,
>
>Do you get this error with current binaries from
>http://jdbc.fastcrypt.com

Yes, with the latest binaries I get approximately :

EXCEPTION Quelque chose de peu commun sest produit pour faire ??chouer
le gestionnaire. Veuillez enregistrer cette exception: {0}

You can find it into : org/postgres/errors_fr.properties

With my modified/kludge version I get :

"... java.sql.SQLException: Password authentification failed for user
'test'"

Denis

>-----Original Message-----
>From: pgsql-jdbc-owner@postgresql.org
>[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Denis Bucher
>Sent: August 8, 2001 7:44 AM
>To: Steve Wampler
>Cc: PGSQL-JDBC
>Subject: Re: [JDBC] Bug found in the driver
>
>
>At 11:07 07.08.01 -0700, you wrote:
>
>Hello !
>
> > > I agree with you. But is there someone that could find the exact
> > > place to correct it ? This would be nice... And it would spare
> > > some time in the mailling-lists, just do a google.com search at
> > > "unusual"
>
> > > and you'll see
> > ;-))
> >
> >I thought I'd take more of a look at this (because I don't want to do

> >the work I'm supposed to be doing!).  It looks for all the world to
> >me that the code is correct and that somehow MessageFormat.format()
> >isn't working properly.  This is, of course, unlikely, since I'm
> >pretty sure Sun has tested MessageFormat quite a bit!
> >
> >Do you have a simple test case I can run that will show the problem?
> >There's not much I can do without being able to reproduce the
> >problem.
>
>It is very easy to reproduce the bug !
>
>Just change you pg_hba.conf so that the host on which you are has got
>no entry. And you'll see :
>
>Instead of saying "unusual error, please record the following exception
>: No pg_hba.conf entry for host 192.168.200.4, user postgres database
>test" (or something like that) it will say only :
>
>"unusual error, please record the following exception : {0}"
>
>Denis
>
>
>
>---------------------------(end of
>broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/users-lounge/docs/faq.html
>
>
>
>---------------------------(end of
>broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/users-lounge/docs/faq.html



Re: Bug found in the driver

From
Barry Lind
Date:
I can't reproduce this error with a 1.3.1 JDK and the 7.1.2 driver.
When disabling access through pg_hba.conf I get the following correct
error with the {0} filled in by the exception information:

Something unusual has occured to cause the driver to fail. Please report
this exception: Exception: java.sql.SQLException: No pg_hba.conf entry
for host 127.0.0.1, user blind, database xythos3
Stack Trace:

java.sql.SQLException: No pg_hba.conf entry for host 127.0.0.1, user
blind, database xythos3
    at org.postgresql.Connection.openConnection(Connection.java:170)
    at org.postgresql.Driver.connect(Driver.java:122)
    at java.sql.DriverManager.getConnection(DriverManager.java:517)
...


thanks,
--Barry



Denis Bucher wrote:
> At 22:01 03.08.01 +0200, you wrote:
>
> Hello !
>
>> On Fri, 03 Aug 2001 15:06:46 +0200, Denis Bucher wrote:
>> >I've FOUND A BUG in the postgres JDBC driver !
>>
>> OK, please help us fix it.
>>
>> >If you want to see the source online :
>> >http://cs.baylor.edu/~speegle/5335/org/postgresql/
>> >
>> >Please look at Driver.class :
>> >
>> >     } catch(Exception ex2) {
>> >         throw new PSQLException("postgresql.unusual",ex2);
>> >
>> >But it doesn't print the exception ex2 !!!
>>
>> This code is not supposed to print an exception. Please be more
>> specific. What are you doing exactly? Why are we looking at this
>> particular line of source code? What exception did you expect?
>> Why did you expect it to be printed?
>
>
> Ok, this line prints the following message :
>
> Quelque chose de peu commun s'est produit pour faire ?échouer le
> gestionnaire. Veuillez enregistrer cette exception: {0}
>
> which is the french version of :
>
> Something unusual has occured to cause the driver to fail.
> Please report this exception: {0}
>
> BUT it doesn't print the exception between '{' and '}' which makes
> VERY hard to debug the problem. I found LOTS of emails in
> mailing-lists only due to this problem : If the exception was
> printed, people wouldn't have asked because they would have
> seen "this host is not present in hba_conf", or something like
> that. With my 'kludge-correction' it PRINTS the EXACT exception
> that made the driver fail :
>
> throw new PSQLException("postgresql.unusual: " + ex2);
>
> But I know my correction isn't 'clean' because it circumvents the
> PSQLException method that IMHO SHOULD print out the exception,
> or else why the hell would there be that message "please report this
> exception : {0}" AND why whould 'ex2' be mentionned ?
>
> Denis
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>



Re: Bug found in the driver

From
Denis Bucher
Date:
At 20:20 08.08.01 -0700, Barry Lind wrote:
>I can't reproduce this error with a 1.3.1 JDK and the 7.1.2 driver. When
>disabling access through pg_hba.conf I get the following correct error
>with the {0} filled in by the exception information:
>
>Something unusual has occured to cause the driver to fail. Please report
>this exception: Exception: java.sql.SQLException: No pg_hba.conf entry for
>host 127.0.0.1, user blind, database xythos3

Surprising ! I deleted the errors.fr file and now the error diseaperead !

Which means there is a problem either in the locale language support or
somewhere else... ... We'll never find I think ;-) It's maybe even not in
the driver ?

Denis

>Denis Bucher wrote:
>>At 22:01 03.08.01 +0200, you wrote:
>>Hello !
>>
>>>On Fri, 03 Aug 2001 15:06:46 +0200, Denis Bucher wrote:
>>> >I've FOUND A BUG in the postgres JDBC driver !
>>>
>>>OK, please help us fix it.
>>>
>>> >If you want to see the source online :
>>> >http://cs.baylor.edu/~speegle/5335/org/postgresql/
>>> >
>>> >Please look at Driver.class :
>>> >
>>> >     } catch(Exception ex2) {
>>> >         throw new PSQLException("postgresql.unusual",ex2);
>>> >
>>> >But it doesn't print the exception ex2 !!!
>>>
>>>This code is not supposed to print an exception. Please be more
>>>specific. What are you doing exactly? Why are we looking at this
>>>particular line of source code? What exception did you expect?
>>>Why did you expect it to be printed?
>>
>>Ok, this line prints the following message :
>>Quelque chose de peu commun s'est produit pour faire ?échouer le
>>gestionnaire. Veuillez enregistrer cette exception: {0}
>>which is the french version of :
>>Something unusual has occured to cause the driver to fail.
>>Please report this exception: {0}
>>BUT it doesn't print the exception between '{' and '}' which makes
>>VERY hard to debug the problem. I found LOTS of emails in
>>mailing-lists only due to this problem : If the exception was
>>printed, people wouldn't have asked because they would have
>>seen "this host is not present in hba_conf", or something like
>>that. With my 'kludge-correction' it PRINTS the EXACT exception
>>that made the driver fail :
>>throw new PSQLException("postgresql.unusual: " + ex2);
>>But I know my correction isn't 'clean' because it circumvents the
>>PSQLException method that IMHO SHOULD print out the exception,
>>or else why the hell would there be that message "please report this
>>exception : {0}" AND why whould 'ex2' be mentionned ?
>>Denis
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


Re: Re: Bug found in the driver

From
Rene Pijlman
Date:
On Thu, 09 Aug 2001 12:07:41 +0200, you wrote:
>Surprising ! I deleted the errors.fr file and now the error diseaperead !

Hmmm... what happens when you replace the content of errors_fr
with the content of errors?

There are some funny SOH bytes in errors_fr: 0x01 and that's
pretty close to 0x00 :-)

Regards,
René Pijlman