This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to tag REL8_2_511 in repository libpostgresql-jdbc-java.
commit dba43e46c5f09162a75c15e6bde0ae97042eee0f Author: Kris Jurka <[email protected]> Date: Sat May 1 15:43:59 2010 +0000 PoolingDataSources were not picking up all of the properties that were set for them. Notably it would not give you a SSL connection when asked. It was copying individual properties over piecemeal and this got out of date as new properties were added to the BaseDataSource, but not added to the copying code. Use the existing serialization code to ensure that we really do copy all of the properties over. Backpatch back to 8.2 as earlier versions don't have many of these properties and the code has diverged. Per report by Eric Jain. --- org/postgresql/ds/common/BaseDataSource.java | 19 +++++++++++++++---- .../ds/jdbc23/AbstractJdbc23PoolingDataSource.java | 15 +++++++++------ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/org/postgresql/ds/common/BaseDataSource.java b/org/postgresql/ds/common/BaseDataSource.java index d5f9676..527365e 100644 --- a/org/postgresql/ds/common/BaseDataSource.java +++ b/org/postgresql/ds/common/BaseDataSource.java @@ -3,19 +3,21 @@ * Copyright (c) 2004-2005, PostgreSQL Global Development Group * * IDENTIFICATION -* $PostgreSQL: pgjdbc/org/postgresql/ds/common/BaseDataSource.java,v 1.6 2005/01/11 08:25:45 jurka Exp $ +* $PostgreSQL: pgjdbc/org/postgresql/ds/common/BaseDataSource.java,v 1.7 2005/02/02 23:30:31 oliver Exp $ * *------------------------------------------------------------------------- */ package org.postgresql.ds.common; import javax.naming.*; -import java.io.PrintWriter; import java.sql.*; -import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; +import java.io.PrintWriter; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; /** * Base class for data sources and related classes. @@ -326,4 +328,13 @@ public abstract class BaseDataSource implements Referenceable loginTimeout = in.readInt(); } + public void initializeFrom(BaseDataSource source) throws IOException, ClassNotFoundException { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos); + source.writeBaseObject(oos); + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + ObjectInputStream ois = new ObjectInputStream(bais); + readBaseObject(ois); + } + } diff --git a/org/postgresql/ds/jdbc23/AbstractJdbc23PoolingDataSource.java b/org/postgresql/ds/jdbc23/AbstractJdbc23PoolingDataSource.java index 469d60a..fa8c3fb 100644 --- a/org/postgresql/ds/jdbc23/AbstractJdbc23PoolingDataSource.java +++ b/org/postgresql/ds/jdbc23/AbstractJdbc23PoolingDataSource.java @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005, PostgreSQL Global Development Group * * IDENTIFICATION -* $PostgreSQL$ +* $PostgreSQL: pgjdbc/org/postgresql/ds/jdbc23/AbstractJdbc23PoolingDataSource.java,v 1.1 2006/11/29 04:03:48 jurka Exp $ * *------------------------------------------------------------------------- */ @@ -287,15 +287,18 @@ public abstract class AbstractJdbc23PoolingDataSource extends BaseDataSource synchronized (lock ) { source = createConnectionPool(); - source.setDatabaseName(getDatabaseName()); - source.setPassword(getPassword()); - source.setPortNumber(getPortNumber()); - source.setServerName(getServerName()); - source.setUser(getUser()); + try { + source.initializeFrom(this); + } catch (Exception e) { + throw new PSQLException(GT.tr("Failed to setup DataSource."), + PSQLState.UNEXPECTED_ERROR, e); + } + while (available.size() < initialConnections) { available.push(source.getPooledConnection()); } + initialized = true; } } -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

