This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to annotated tag REL9_3_1102 in repository libpostgresql-jdbc-java.
commit b9d7fc610f77c53a7c00b41c7076c1549266b0b2 Author: Dave Cramer <[email protected]> Date: Tue Jul 8 16:12:14 2014 -0400 fix copyOut close hanging bug #161 from epgrubmair --- org/postgresql/copy/CopyManager.java | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/org/postgresql/copy/CopyManager.java b/org/postgresql/copy/CopyManager.java index a2a1331..a67d0c6 100644 --- a/org/postgresql/copy/CopyManager.java +++ b/org/postgresql/copy/CopyManager.java @@ -84,7 +84,18 @@ public class CopyManager { to.write(encoding.decode(buf)); } return cp.getHandledRowCount(); - } finally { // see to it that we do not leave the connection locked + } + catch ( IOException ioEX) { + // if not handled this way the close call will hang, at least in 8.2 + if(cp.isActive()) + cp.cancelCopy(); + try { // read until excausted or operation cancelled SQLException + while( (buf = cp.readFromCopy()) != null ) {} + } + catch ( SQLException sqlEx ) {} // typically after several kB + throw ioEX; + } + finally { // see to it that we do not leave the connection locked if(cp.isActive()) cp.cancelCopy(); } @@ -106,7 +117,18 @@ public class CopyManager { to.write(buf); } return cp.getHandledRowCount(); - } finally { // see to it that we do not leave the connection locked + } + catch ( IOException ioEX) { + // if not handled this way the close call will hang, at least in 8.2 + if(cp.isActive()) + cp.cancelCopy(); + try { // read until excausted or operation cancelled SQLException + while( (buf = cp.readFromCopy()) != null ) {} + } + catch ( SQLException sqlEx ) {} // typically after several kB + throw ioEX ; + } + finally { // see to it that we do not leave the connection locked if(cp.isActive()) cp.cancelCopy(); } -- 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

