Error reporting issue in SimpleParameterList

From: <Nathan(dot)Keynes(at)csiro(dot)au>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Error reporting issue in SimpleParameterList
Date: 2007-06-13 03:36:54
Message-ID: B998A44C8986644EA8029CFE6396A9246F4C9D@exqld2-bne.nexus.csiro.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,

In org.postgresql.core.v3.SimpleParameterList there is the following
code:

void setResolvedType(int index, int oid) {
// only allow overwriting an unknown value
if (paramTypes[index-1] == Oid.UNSPECIFIED) {
paramTypes[index-1] = oid;
} else if (paramTypes[index-1] != oid) {
throw new IllegalArgumentException("Can't change resolved
type for param: " + index + " from " + paramTypes[index] + " to " +
oid);
}
}

In the throw statement, paramTypes[index] should be paramTypes[index-1].
(This was a little confusing until we spotted it).

It's possible the message could be more explanatory as well, would
something like "Param " + index + " type mismatch - expected " +
getNameForOid(oid) + " but was bound to " +
getNameForOid(paramTypes[index-1]) make sense?

Cheers,
Nathan

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message LITTLE Nelson 2007-06-13 05:58:24 Using INET types in prepared statements in Java?
Previous Message Kalle Hallivuori 2007-06-11 19:55:41 Re: FYI: porting Copy API to 8.x