db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r1127843 - in /db/derby/code/branches/10.7: ./ java/engine/org/apache/derby/impl/io/vfmem/BlockedByteArray.java
Date Thu, 26 May 2011 09:36:43 GMT
Author: kristwaa
Date: Thu May 26 09:36:43 2011
New Revision: 1127843

URL: http://svn.apache.org/viewvc?rev=1127843&view=rev
Log:
DERBY-5098: embedded/in-memory: SQLNonTransientConnectionException: No current connection
due to invalid page format

Merged fix from trunk (r1103681,1103718).

Modified:
    db/derby/code/branches/10.7/   (props changed)
    db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/io/vfmem/BlockedByteArray.java

Propchange: db/derby/code/branches/10.7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu May 26 09:36:43 2011
@@ -1 +1 @@
-/db/derby/code/trunk:1035603,1036769,1038514,1038813,1039084,1039268,1040658,1041338,1043227,1043389,1044096,1051026,1053724,1055169,1059888,1060480,1062096,1063809,1065061,1066290,1067250,1067357,1069661,1071463,1071886,1076387,1078461,1078693,1081455,1085078,1091000,1097247
+/db/derby/code/trunk:1035603,1036769,1038514,1038813,1039084,1039268,1040658,1041338,1043227,1043389,1044096,1051026,1053724,1055169,1059888,1060480,1062096,1063809,1065061,1066290,1067250,1067357,1069661,1071463,1071886,1076387,1078461,1078693,1081455,1085078,1091000,1097247,1103681,1103718

Modified: db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/io/vfmem/BlockedByteArray.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/io/vfmem/BlockedByteArray.java?rev=1127843&r1=1127842&r2=1127843&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/io/vfmem/BlockedByteArray.java
(original)
+++ db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/io/vfmem/BlockedByteArray.java
Thu May 26 09:36:43 2011
@@ -143,7 +143,7 @@ public class BlockedByteArray {
         if (blockSize == 0) {
             checkBlockSize((int)Math.min(Integer.MAX_VALUE, newLength));
         }
-        final long currentCapacity = allocatedBlocks * blockSize;
+        final long currentCapacity = (long)allocatedBlocks * blockSize;
         if (newLength > currentCapacity) {
             // Allocate more blocks.
             increaseCapacity(newLength);
@@ -187,9 +187,7 @@ public class BlockedByteArray {
             throw new ArrayIndexOutOfBoundsException(len);
         }
         // Increase the capacity if required.
-        if (pos + len >= allocatedBlocks * blockSize) {
-            increaseCapacity(pos + len);
-        }
+        increaseCapacity(pos + len);
         // Calculate the block number and the index within this block.
         int block = (int)(pos / blockSize);
         int index = (int)(pos % blockSize);
@@ -226,10 +224,7 @@ public class BlockedByteArray {
             checkBlockSize(0);
         }
         // Increase the capacity if required.
-        if (pos >= allocatedBlocks * blockSize) {
-            increaseCapacity(pos);
-        }
-
+        increaseCapacity(pos);
         // Calculate the block number and the index within this block.
         int block = (int)(pos / blockSize);
         int index = (int)(pos % blockSize);
@@ -301,7 +296,7 @@ public class BlockedByteArray {
             SanityManager.ASSERT(blockSize > 0, "Invalid/unset block size");
         }
         // Safe-guard to avoid overwriting existing data.
-        if (lastIndex < allocatedBlocks * blockSize) {
+        if (lastIndex < (long)allocatedBlocks * blockSize) {
             return;
         }
         // Calculate required number of blocks, and create those lacking.



Mime
View raw message