myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r992178 - /myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java
Date Fri, 03 Sep 2010 02:27:54 GMT
Author: lu4242
Date: Fri Sep  3 02:27:54 2010
New Revision: 992178

URL: http://svn.apache.org/viewvc?rev=992178&view=rev
Log:
TOMAHAWK-1460 ClassCastException when testing Tomahawk 1.1.9 table demos when preserveDataModel="true"
(cast for _SerializableDataModel first)

Modified:
    myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java

Modified: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java?rev=992178&r1=992177&r2=992178&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java
(original)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlDataTable.java
Fri Sep  3 02:27:54 2010
@@ -1036,40 +1036,44 @@ public abstract class AbstractHtmlDataTa
         ValueExpression vb = getValueExpression("value");
         if (vb != null && !vb.isReadOnly(context.getELContext()))
         {
-            _SerializableDataModel dm = (_SerializableDataModel) getDataModel();
-            Class type = (getValueType() == null) ? 
-                    vb.getType(context.getELContext()) : 
-                        ClassUtils.simpleClassForName(getValueType());
-            Class dmType = dm.getClass();
-            if (DataModel.class.isAssignableFrom(type))
+            DataModel qdm = getDataModel();
+            if (qdm instanceof _SerializableDataModel)
             {
-                vb.setValue(context.getELContext(), dm);
-            }
-            else if (List.class.isAssignableFrom(type) || _SerializableListDataModel.class.isAssignableFrom(dmType))
-            {
-                vb.setValue(context.getELContext(), dm.getWrappedData());
-            }
-            else if (OBJECT_ARRAY_CLASS.isAssignableFrom(type))
-            {
-                List lst = (List) dm.getWrappedData();
-                vb.setValue(context.getELContext(), lst.toArray(new Object[lst.size()]));
-            }
-            else if (ResultSet.class.isAssignableFrom(type))
-            {
-                throw new UnsupportedOperationException(this.getClass().getName()
-                        + " UnsupportedOperationException");
-            }
-            else
-            {
-                //Assume scalar data model
-                List lst = (List) dm.getWrappedData();
-                if (lst!= null && lst.size() > 0)
+                _SerializableDataModel dm = (_SerializableDataModel) qdm;
+                Class type = (getValueType() == null) ? 
+                        vb.getType(context.getELContext()) : 
+                            ClassUtils.simpleClassForName(getValueType());
+                Class dmType = dm.getClass();
+                if (DataModel.class.isAssignableFrom(type))
                 {
-                    vb.setValue(context.getELContext(), lst.get(0));
+                    vb.setValue(context.getELContext(), dm);
+                }
+                else if (List.class.isAssignableFrom(type) || _SerializableListDataModel.class.isAssignableFrom(dmType))
+                {
+                    vb.setValue(context.getELContext(), dm.getWrappedData());
+                }
+                else if (OBJECT_ARRAY_CLASS.isAssignableFrom(type))
+                {
+                    List lst = (List) dm.getWrappedData();
+                    vb.setValue(context.getELContext(), lst.toArray(new Object[lst.size()]));
+                }
+                else if (ResultSet.class.isAssignableFrom(type))
+                {
+                    throw new UnsupportedOperationException(this.getClass().getName()
+                            + " UnsupportedOperationException");
                 }
                 else
                 {
-                    vb.setValue(context.getELContext(), null);
+                    //Assume scalar data model
+                    List lst = (List) dm.getWrappedData();
+                    if (lst!= null && lst.size() > 0)
+                    {
+                        vb.setValue(context.getELContext(), lst.get(0));
+                    }
+                    else
+                    {
+                        vb.setValue(context.getELContext(), null);
+                    }
                 }
             }
         }



Mime
View raw message