db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r542269 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc: EmbedClob.java UTF8Reader.java
Date Mon, 28 May 2007 16:41:55 GMT
Author: kristwaa
Date: Mon May 28 09:41:54 2007
New Revision: 542269

URL: http://svn.apache.org/viewvc?view=rev&rev=542269
Log:
DERBY-2868: Changed UTF8Reader to return 0 instead of -1 in skip when EOF is reached. Changed
usages in EmbedClob accordingly.
Patch file: derby-2686-2a-reader.diff

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedClob.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/UTF8Reader.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedClob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedClob.java?view=diff&rev=542269&r1=542268&r2=542269
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedClob.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedClob.java Mon May 28 09:41:54
2007
@@ -206,7 +206,7 @@
                 for (;;)
                 {
                     long size = clobReader.skip(32 * 1024);
-                    if (size == -1)
+                    if (size == 0L)
                         break;
                     clobLength += size;
                 }
@@ -396,7 +396,7 @@
         long remainToSkip = position - 1;
         while (remainToSkip > 0) {
             long skipBy = clobReader.skip(remainToSkip);
-            if (skipBy == -1)
+            if (skipBy == 0L)
                 return null;
 
             remainToSkip -= skipBy;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/UTF8Reader.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/UTF8Reader.java?view=diff&rev=542269&r1=542268&r2=542269
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/UTF8Reader.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/UTF8Reader.java Mon May 28
09:41:54 2007
@@ -144,6 +144,10 @@
 	}
 
 	public long skip(long len) throws IOException {
+		if (len < 0) {
+			throw new IllegalArgumentException(
+				"Number of characters to skip must be positive:" + len);
+		}
 		synchronized (lock) {
 			// check if closed..
 			if (noMoreReads)
@@ -152,7 +156,7 @@
 			if (readPositionInBuffer >= charactersInBuffer) {
 				// do somthing
 				if (fillBuffer()) {
-					return -1;
+					return 0L;
 				}
 				readPositionInBuffer = 0;
 			}



Mime
View raw message