Re: Bug found in the driver

From: Steve Wampler <swampler(at)noao(dot)edu>
To: Denis Bucher <dbucher(at)niftycom(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Bug found in the driver
Date: 2001-08-07 15:37:26
Message-ID: 3B700B36.C3498CF5@noao.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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(at)noao(dot)edu

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Rene Pijlman 2001-08-07 16:54:13 Re: cast in JDBC update
Previous Message Dav Coleman 2001-08-07 15:37:21 BIGINT vs Java's long