db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r1600417 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/store/raw/data/AllocPage.java engine/org/apache/derby/loc/messages.xml shared/org/apache/derby/shared/common/reference/SQLState.java
Date Wed, 04 Jun 2014 18:40:36 GMT
Author: myrnavl
Date: Wed Jun  4 18:40:35 2014
New Revision: 1600417

URL: http://svn.apache.org/r1600417
Log:
DERBY-6504; change AllocPage.ReadContainerInfo to catch ArrayIndexOutOfBoundsException and
turn it into Derby error.
   Adding error message XSDG4 to provide analysis info if this exception is hit

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/AllocPage.java
    db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
    db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/AllocPage.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/AllocPage.java?rev=1600417&r1=1600416&r2=1600417&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/AllocPage.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/AllocPage.java Wed
Jun  4 18:40:35 2014
@@ -596,6 +596,7 @@ public class AllocPage extends StoredPag
 	*/
 	public static void ReadContainerInfo(byte[] containerInfo,
 										 byte[] epage)
+	throws StandardException
 	{
 		int N = (int)epage[BORROWED_SPACE_OFFSET];
 
@@ -612,8 +613,29 @@ public class AllocPage extends StoredPag
 		}
 
 		if (N != 0)
-			System.arraycopy(epage, BORROWED_SPACE_OFFSET+BORROWED_SPACE_LEN,
-							 containerInfo, 0, N);
+		{
+		    try {
+		        System.arraycopy(
+		                epage, BORROWED_SPACE_OFFSET+BORROWED_SPACE_LEN,
+						containerInfo, 0, N);
+		    }  catch (ArrayIndexOutOfBoundsException ioobe) {
+                throw StandardException.newException (
+                    SQLState.DATA_UNEXPECTED_EXCEPTION, 
+                        StandardException.newException (
+                            SQLState.UNABLE_TO_ARRAYCOPY,
+                            ioobe,
+                            epage.length, containerInfo.length,
+                            MAX_BORROWED_SPACE,
+                            BORROWED_SPACE_OFFSET,
+                            BORROWED_SPACE_LEN,
+                            BORROWED_SPACE_OFFSET + BORROWED_SPACE_LEN,
+                            N,
+                            org.apache.derby.iapi.util.StringUtil.hexDump(
+                                    epage)
+                        )
+                );
+		    }
+		} 
 	}
 
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml?rev=1600417&r1=1600416&r2=1600417&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/loc/messages.xml Wed Jun  4 18:40:35
2014
@@ -6178,6 +6178,19 @@ ln=lower-case two-letter ISO-639 languag
             </msg>
 
             <msg>
+                <name>XSDG4.D</name>
+                <text>Unrecoverable internal error encountered while attempting to
read low level metadata about the table or index. Please provide your support organization
with the following exception information: Failed: arraycopy of embryonic page byte[{0}] to
container information byte[{1}]. Values of variables and constants: MAX_BORROWED_SPACE: {2},
BORROWED_SPACE_OFFSET({3}) + BORROWED_SPACE_LENG({4}) = {5}; arraycopylength: {6}; embryonic
page {7}.</text>
+                <arg>pageArrayLength</arg>
+                <arg>containerArrayLength</arg>
+                <arg>maxBorrowedSpace</arg>
+                <arg>borrowedSpaceOffset</arg>
+                <arg>borrowedSpaceLength</arg>
+                <arg>arraycopySourcePosition</arg>
+                <arg>maxBorrowableSpace</arg>
+                <arg>hexdump</arg>
+            </msg>
+
+            <msg>
                 <name>XSDG5.D</name>
                 <text>Database is not in create mode when createFinished is called.</text>
             </msg>

Modified: db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java?rev=1600417&r1=1600416&r2=1600417&view=diff
==============================================================================
--- db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
(original)
+++ db/derby/code/trunk/java/shared/org/apache/derby/shared/common/reference/SQLState.java
Wed Jun  4 18:40:35 2014
@@ -540,6 +540,7 @@ public interface SQLState {
 	String FILE_WRITE_PAGE_EXCEPTION                            = "XSDG1.D";
 	String FILE_BAD_CHECKSUM                                    = "XSDG2.D";
 	String FILE_CONTAINER_EXCEPTION                             = "XSDG3.D";
+    String UNABLE_TO_ARRAYCOPY                                  = "XSDG4.D";
 	String FILE_DATABASE_NOT_IN_CREATE                          = "XSDG5.D";
 	String DATA_DIRECTORY_NOT_FOUND_IN_BACKUP                   = "XSDG6.D";
 	String UNABLE_TO_REMOVE_DATA_DIRECTORY                      = "XSDG7.D";



Mime
View raw message