Lists: | pgsql-jdbc |
---|
From: | Fedechicco <fedechicco(at)gmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Possible bug in ServerErrorMessage.java |
Date: | 2012-04-26 11:34:17 |
Message-ID: | CAO+LWtxB6UzLkMsSTF2E5WWegcxX2eVB4cWcKSwxwNDgiadnOA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
Hi everbody,
I'm trying to use the postgre jdbc driver with little success.
I keep getting this incomprehensible error message:
org.postgresql.util.PSQLException: Something unusual has occured to
cause the driver to fail. Please report this exception.
at org.postgresql.Driver.connect(Driver.java:280)
at java.sql.DriverManager.getConnection(DriverManager.java:620)
at java.sql.DriverManager.getConnection(DriverManager.java:169)
at com.moxoff.meshrepository.SQLConnector.getConnection(SQLConnector.java:40)
at com.moxoff.meshrepository.MeshRepository.<init>(MeshRepository.java:23)
at com.moxoff.meshrepository.Main.main(Main.java:80)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 6
at org.postgresql.util.ServerErrorMessage.<init>(ServerErrorMessage.java:48)
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:273)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:95)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:124)
at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
at org.postgresql.Driver.makeConnection(Driver.java:386)
at org.postgresql.Driver.connect(Driver.java:260)
... 5 more
From what I've seen the line 48 and the following are:
while (l_chars[l_pos] != '\0' && l_pos < l_length)
{
l_pos++;
}
which IMO should be changed in:
while (l_pos < l_length && l_chars[l_pos] != '\0')
cheers,
Fedechicco
From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
---|---|
To: | Fedechicco <fedechicco(at)gmail(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Possible bug in ServerErrorMessage.java |
Date: | 2012-04-27 00:43:41 |
Message-ID: | CADK3HHLc97dm6uVpJrKHS8pUhHsaFEDu7myMUy5s4SG7KVPsKg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
Can you send a repeatable test case ?
What version of the driver are you using and what version of the server ?
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
On Thu, Apr 26, 2012 at 7:34 AM, Fedechicco <fedechicco(at)gmail(dot)com> wrote:
> Hi everbody,
>
> I'm trying to use the postgre jdbc driver with little success.
> I keep getting this incomprehensible error message:
>
> org.postgresql.util.PSQLException: Something unusual has occured to
> cause the driver to fail. Please report this exception.
> at org.postgresql.Driver.connect(Driver.java:280)
> at java.sql.DriverManager.getConnection(DriverManager.java:620)
> at java.sql.DriverManager.getConnection(DriverManager.java:169)
> at com.moxoff.meshrepository.SQLConnector.getConnection(SQLConnector.java:40)
> at com.moxoff.meshrepository.MeshRepository.<init>(MeshRepository.java:23)
> at com.moxoff.meshrepository.Main.main(Main.java:80)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 6
> at org.postgresql.util.ServerErrorMessage.<init>(ServerErrorMessage.java:48)
> at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:273)
> at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:95)
> at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
> at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:124)
> at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
> at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
> at org.postgresql.Driver.makeConnection(Driver.java:386)
> at org.postgresql.Driver.connect(Driver.java:260)
> ... 5 more
>
> From what I've seen the line 48 and the following are:
>
> while (l_chars[l_pos] != '\0' && l_pos < l_length)
> {
> l_pos++;
> }
>
> which IMO should be changed in:
> while (l_pos < l_length && l_chars[l_pos] != '\0')
>
> cheers,
> Fedechicco
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
From: | Maciek Sakrejda <msakrejda(at)truviso(dot)com> |
---|---|
To: | Dave Cramer <pg(at)fastcrypt(dot)com> |
Cc: | Fedechicco <fedechicco(at)gmail(dot)com>, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Possible bug in ServerErrorMessage.java |
Date: | 2012-04-27 06:25:55 |
Message-ID: | CAH_hXRbsLzYBex1AdD+UW1bZdQCkoKTYf5e7_pOSNSTSytH6eQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
> From what I've seen the line 48 and the following are:
>
> while (l_chars[l_pos] != '\0' && l_pos < l_length)
> {
> l_pos++;
> }
>
> which IMO should be changed in:
> while (l_pos < l_length && l_chars[l_pos] != '\0')
This seems to be the code in question, to decode the wire ErrorResponse message:
https://github.com/pgjdbc/pgjdbc/blob/master/org/postgresql/util/ServerErrorMessage.java#L32
Although what you suggested would be more defensive coding, if you
look at the message specification [1], I believe the current code
*should* process any well-formed ErrorResponse message correctly. As
Dave asked, is this consistently reproducible? Also, are you in a
position to make the change you suggested, rebuild the driver, and
retry it yourself? If so, do you get a different message?
[1]: http://www.postgresql.org/docs/9.1/static/protocol-message-formats.html
---
Maciek Sakrejda | System Architect | Truviso
1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com
From: | Fedechicco <fedechicco(at)gmail(dot)com> |
---|---|
To: | Maciek Sakrejda <msakrejda(at)truviso(dot)com> |
Cc: | Dave Cramer <pg(at)fastcrypt(dot)com>, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Possible bug in ServerErrorMessage.java |
Date: | 2012-04-27 07:48:57 |
Message-ID: | CAO+LWty8kgXkr1h2fPQ4-ZZhEoaROMOXov0akc_QTCWLcQRA1Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
I used the package postgresql-9.1-902.jdbc4.jar downloaded from the
official site and the version 8.3-603 downloaded through the Ubuntu
repository.
The postgresql i'm using is the 9.1.3.
I can hardly send you a repeatable test, since it is obviously a
problem with my postgre settings (aka I probably did something wrong
while setting the database up).
Anyway, IMO, the exception thrown by that piece of code is misleading,
since an out of bound exception is thrown while building another
exception that should signal another more useful error (which would
have probably told me what was my real problem).
I don't have the permission of my boss to work in first person on the
bug fix, i just felt it was useful to report it.
I would point out anyway that the second part of this boolean
condition (l_pos < l_length) is completely useless:
while(l_chars[l_pos] != '\0' && l_pos < l_length)
since it would evaluate false when and only when an out of bound
exception has already been thrown by the first part (l_chars[l_pos] !=
'\0').
Regards,
Fedechicco
2012/4/27 Maciek Sakrejda <msakrejda(at)truviso(dot)com>:
>> From what I've seen the line 48 and the following are:
>>
>> while (l_chars[l_pos] != '\0' && l_pos < l_length)
>> {
>> l_pos++;
>> }
>>
>> which IMO should be changed in:
>> while (l_pos < l_length && l_chars[l_pos] != '\0')
>
> This seems to be the code in question, to decode the wire ErrorResponse message:
>
> https://github.com/pgjdbc/pgjdbc/blob/master/org/postgresql/util/ServerErrorMessage.java#L32
>
> Although what you suggested would be more defensive coding, if you
> look at the message specification [1], I believe the current code
> *should* process any well-formed ErrorResponse message correctly. As
> Dave asked, is this consistently reproducible? Also, are you in a
> position to make the change you suggested, rebuild the driver, and
> retry it yourself? If so, do you get a different message?
>
> [1]: http://www.postgresql.org/docs/9.1/static/protocol-message-formats.html
> ---
> Maciek Sakrejda | System Architect | Truviso
>
> 1065 E. Hillsdale Blvd., Suite 215
> Foster City, CA 94404
> (650) 242-3500 Main
> www.truviso.com
From: | "ml-tb" <ml-tb(at)emagixx(dot)de> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Possible bug in ServerErrorMessage.java |
Date: | 2012-04-27 08:13:57 |
Message-ID: | 201204271013.57993.ml-tb@emagixx.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
Am Freitag, 27. April 2012 schrieb Maciek Sakrejda:
> > From what I've seen the line 48 and the following are:
> >
> > while (l_chars[l_pos] != '\0' && l_pos < l_length)
> > {
> >
> > l_pos++;
> >
> > }
> >
> > which IMO should be changed in:
> > while (l_pos < l_length && l_chars[l_pos] != '\0')
>
> This seems to be the code in question, to decode the wire
> ErrorResponse message:
>
> https://github.com/pgjdbc/pgjdbc/blob/master/org/postgresql/util/Serv
> erErrorMessage.java#L32
>
> Although what you suggested would be more defensive coding,
Sorry for correct you at this point: The suggested code ist not more
defensive but the only correct way for a save (unsyncronised) array
access.
Bye Thomas
From: | Maciek Sakrejda <msakrejda(at)truviso(dot)com> |
---|---|
To: | ml-tb(at)emagixx(dot)de |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Possible bug in ServerErrorMessage.java |
Date: | 2012-04-27 13:25:08 |
Message-ID: | CAH_hXRby2DTnYEFLM4dz8wKzSHjKobsg4y9fwxHsi=kCkiqhgQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
>> Although what you suggested would be more defensive coding,
> Sorry for correct you at this point: The suggested code ist not more
> defensive but the only correct way for a save (unsyncronised) array
> access.
...for arbitrary data, which is *not* what the message is designed to parse.
---
Maciek Sakrejda | System Architect | Truviso
1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com
From: | Maciek Sakrejda <msakrejda(at)truviso(dot)com> |
---|---|
To: | ml-tb(at)emagixx(dot)de |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Possible bug in ServerErrorMessage.java |
Date: | 2012-04-27 13:27:22 |
Message-ID: | CAH_hXRYTz0qShBAOxt0Cj_xh=+iubcrc5ChxfhuUBUFDuyVaTw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
More constructively, I don't think that this is Fedechicco's root
problem. If we make this change (and we probably should) he'll just
see another error. I'd like to try to figure out what that is, so that
in case it's another driver issue, we can address it at the same time.
---
Maciek Sakrejda | System Architect | Truviso
1065 E. Hillsdale Blvd., Suite 215
Foster City, CA 94404
(650) 242-3500 Main
www.truviso.com
From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
---|---|
To: | Maciek Sakrejda <msakrejda(at)truviso(dot)com> |
Cc: | ml-tb(at)emagixx(dot)de, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Possible bug in ServerErrorMessage.java |
Date: | 2012-04-27 13:33:42 |
Message-ID: | CADK3HHJvDfq2Xzi+v9UG6zAfDKscSTL5A8TOZBrKjkfiWY-Q-w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
On Fri, Apr 27, 2012 at 9:27 AM, Maciek Sakrejda <msakrejda(at)truviso(dot)com> wrote:
> More constructively, I don't think that this is Fedechicco's root
> problem. If we make this change (and we probably should) he'll just
> see another error. I'd like to try to figure out what that is, so that
> in case it's another driver issue, we can address it at the same time.
Agreed, I was going to commit a change today
But I would like to see the root of the problem as well.
Dave Cramer
dave.cramer(at)credativ(dot)ca
http://www.credativ.ca
From: | Fedechicco <fedechicco(at)gmail(dot)com> |
---|---|
To: | Dave Cramer <pg(at)fastcrypt(dot)com> |
Cc: | Maciek Sakrejda <msakrejda(at)truviso(dot)com>, ml-tb(at)emagixx(dot)de, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Possible bug in ServerErrorMessage.java |
Date: | 2012-04-27 13:37:38 |
Message-ID: | CAO+LWtyvjKucRgVbENu4ws9thHmtSGK5cw9F1yhDudB_jZ0SNA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-jdbc |
I frankly believe that the root problem is mine and it is not
dependant from the jdbc driver, so I don't think you guys should worry
about it.
I have no experience whatsoever with postgre, and this is probably the
root problem, i'll figure it out myself.
Thanks for the bugfix, best regards,
Fedechicco
2012/4/27 Dave Cramer <pg(at)fastcrypt(dot)com>:
> On Fri, Apr 27, 2012 at 9:27 AM, Maciek Sakrejda <msakrejda(at)truviso(dot)com> wrote:
>> More constructively, I don't think that this is Fedechicco's root
>> problem. If we make this change (and we probably should) he'll just
>> see another error. I'd like to try to figure out what that is, so that
>> in case it's another driver issue, we can address it at the same time.
>
> Agreed, I was going to commit a change today
>
> But I would like to see the root of the problem as well.
>
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
> --
> Sent via pgsql-jdbc mailing list (pgsql-jdbc(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc