db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r1057333 - in /db/derby/code/branches/10.4: ./ java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java java/engine/org/apache/derby/impl/sql/GenericColumnDescriptor.java
Date Mon, 10 Jan 2011 19:40:03 GMT
Author: kmarsden
Date: Mon Jan 10 19:40:02 2011
New Revision: 1057333

URL: http://svn.apache.org/viewvc?rev=1057333&view=rev
Log:
DERBY-4913 10.3 to 10.5 upgrade fails with java.io.StreamCorruptedException: java.lang.ClassCastException:
org.apache.derby.catalog.types.OldRoutineType incompatible with org.apache.derby.iapi.types.DataTypeDescriptor

merge code change of revision  #1053724 from trunk. Note: test was not backported to 10.4


Modified:
    db/derby/code/branches/10.4/   (props changed)
    db/derby/code/branches/10.4/java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java
    db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/GenericColumnDescriptor.java

Propchange: db/derby/code/branches/10.4/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 10 19:40:02 2011
@@ -1,3 +1,3 @@
 /db/derby/code/branches/10.5:814216,958230
 /db/derby/code/branches/10.6:1055601
-/db/derby/code/trunk:788436,793588,794303,796316,796372,797147,798347,798742,800523,803548,805696,809643,812669,816536,835286,882732,898635,915177,915733,917771,928065,934996,946794,954544,958163,958230,959550,980684,999119
+/db/derby/code/trunk:788436,793588,794303,796316,796372,797147,798347,798742,800523,803548,805696,809643,812669,816536,835286,882732,898635,915177,915733,917771,928065,934996,946794,954544,958163,958230,959550,980684,999119,1053724

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java?rev=1057333&r1=1057332&r2=1057333&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/catalog/types/RoutineAliasInfo.java
Mon Jan 10 19:40:02 2011
@@ -273,7 +273,7 @@ public class RoutineAliasInfo extends Me
      * @param onDiskType The object read that represents the type.
      * @return A type descriptor.
      */
-    private static TypeDescriptor getStoredType(Object onDiskType)
+    public static TypeDescriptor getStoredType(Object onDiskType)
     {
         if (onDiskType instanceof OldRoutineType)
             return ((OldRoutineType) onDiskType).getCatalogType();

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/GenericColumnDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/GenericColumnDescriptor.java?rev=1057333&r1=1057332&r2=1057333&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/GenericColumnDescriptor.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/GenericColumnDescriptor.java
Mon Jan 10 19:40:02 2011
@@ -21,6 +21,7 @@
 
 package org.apache.derby.impl.sql;
 
+import org.apache.derby.catalog.types.RoutineAliasInfo;
 import org.apache.derby.iapi.sql.ResultColumnDescriptor;
 import org.apache.derby.iapi.types.DataTypeDescriptor;
 
@@ -216,7 +217,7 @@ public final class GenericColumnDescript
 		tableName = (String)fh.get("tableName");
 		schemaName = (String)fh.get("schemaName");
 		columnPos = fh.getInt("columnPos");
-		type = (DataTypeDescriptor)fh.get("type");
+		type = getStoredDataTypeDescriptor(fh.get("type"));
 		isAutoincrement = fh.getBoolean("isAutoincrement");
 		updatableByCursor = fh.getBoolean("updatableByCursor");
 	}
@@ -242,4 +243,27 @@ public final class GenericColumnDescript
 			return "";
 		}
 	}
+
+    /**
+     * When retrieving a DataTypeDescriptor, it might just be a regular
+     * DataTypeDescriptor or may be an OldRoutineType, as used for Routine
+     * parameters and return values prior to DERBY-2775. If it is not a regular
+     * DataTypeDescriptor, it must be an OldRoutineType, so convert it to a
+     * DataTypeDescriptor DERBY-4913
+     * 
+     * @param o
+     *            object as obtained by fh.get("type") in readExternal
+     * @return DataTypeDescriptor
+     */
+    private DataTypeDescriptor getStoredDataTypeDescriptor(Object o) {
+
+        if (o instanceof DataTypeDescriptor)
+            return (DataTypeDescriptor) o;
+        else
+            // Must be an OldRoutineType, so we will convert it to a
+            // DataTypeDescriptor for our purposes
+            return DataTypeDescriptor
+                    .getType(RoutineAliasInfo.getStoredType(o));
+    }
+
 }



Mime
View raw message