[libpostgresql-jdbc-java] 03/09: LOB truncation didn't allow truncating to zero length because it was improperly using the positioning length checks which don't allow a zero length.
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:20:48 UTC 2017
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to tag REL8_3_606
in repository libpostgresql-jdbc-java.
commit 05c02408cdf24a441f705c1cd54ec6312cd8caf9
Author: Kris Jurka <books at ejurka.com>
Date: Mon Jan 18 07:47:50 2010 +0000
LOB truncation didn't allow truncating to zero length because it was
improperly using the positioning length checks which don't allow a
zero length.
Simon Kissane
---
org/postgresql/jdbc2/AbstractJdbc2BlobClob.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/org/postgresql/jdbc2/AbstractJdbc2BlobClob.java b/org/postgresql/jdbc2/AbstractJdbc2BlobClob.java
index 6793aec..3a12adf 100644
--- a/org/postgresql/jdbc2/AbstractJdbc2BlobClob.java
+++ b/org/postgresql/jdbc2/AbstractJdbc2BlobClob.java
@@ -3,7 +3,7 @@
* Copyright (c) 2005-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
-* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2BlobClob.java,v 1.8 2007/09/10 08:34:53 jurka Exp $
+* $PostgreSQL: pgjdbc/org/postgresql/jdbc2/AbstractJdbc2BlobClob.java,v 1.9 2008/01/08 06:56:28 jurka Exp $
*
*-------------------------------------------------------------------------
*/
@@ -74,7 +74,15 @@ public abstract class AbstractJdbc2BlobClob
if (!conn.haveMinimumServerVersion("8.3"))
throw new PSQLException(GT.tr("Truncation of large objects is only implemented in 8.3 and later servers."), PSQLState.NOT_IMPLEMENTED);
- assertPosition(len);
+ if (len < 0)
+ {
+ throw new PSQLException(GT.tr("Cannot truncate LOB to a negative length."), PSQLState.INVALID_PARAMETER_VALUE);
+ }
+ if (len > Integer.MAX_VALUE)
+ {
+ throw new PSQLException(GT.tr("PostgreSQL LOBs can only index to: {0}", new Integer(Integer.MAX_VALUE)), PSQLState.INVALID_PARAMETER_VALUE);
+ }
+
lo.truncate((int)len);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git
More information about the pkg-java-commits
mailing list