manolito 2005/04/13 05:48:46
Modified: build/codegen build.default.properties build.xml
src/codegen/org/apache/myfaces/codegen/component
FieldDef.java
src/codegen/org/apache/myfaces/codegen/resource
Component.vsl
src/components/org/apache/myfaces/custom/checkbox
HtmlCheckbox.java
src/components/org/apache/myfaces/custom/radio
HtmlRadio.java
Log:
MYFACES-186 x:radio and x:checkbox cause ClassCastException
Since the proposed fix is within generated code block, I had to fix the generator instead!
Revision Changes Path
1.2 +1 -1 incubator-myfaces/build/codegen/build.default.properties
Index: build.default.properties
===================================================================
RCS file: /home/cvs/incubator-myfaces/build/codegen/build.default.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- build.default.properties 16 Nov 2004 16:25:52 -0000 1.1
+++ build.default.properties 13 Apr 2005 12:48:46 -0000 1.2
@@ -1,7 +1,7 @@
ant.jar = C:\\Develop\\Tools\\apache-ant-1.6.1\\lib\\ant.jar
velocity.jar = C:\\java\\velocity\\velocity-dep-1.4.jar
-sun-jsf-api.jar = C:\\Develop\\jsf-1_0\\lib\\jsf-api.jar
+jsf-api.jar = ${project.dir}/lib/myfaces-jsf-api.jar
single-component = javax/faces/component/UIComponentBase
1.14 +1 -1 incubator-myfaces/build/codegen/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/incubator-myfaces/build/codegen/build.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- build.xml 16 Nov 2004 16:25:52 -0000 1.13
+++ build.xml 13 Apr 2005 12:48:46 -0000 1.14
@@ -26,7 +26,7 @@
<path id="codegen.class.path">
<pathelement location="${ant.jar}"/>
<pathelement location="${velocity.jar}"/>
- <pathelement location="${sun-jsf-api.jar}"/>
+ <pathelement location="${jsf-api.jar}"/>
<pathelement location="${commons-logging.jar}"/>
<pathelement location="${codegen-classes.dir}"/>
</path>
1.7 +15 -2 incubator-myfaces/src/codegen/org/apache/myfaces/codegen/component/FieldDef.java
Index: FieldDef.java
===================================================================
RCS file: /home/cvs/incubator-myfaces/src/codegen/org/apache/myfaces/codegen/component/FieldDef.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FieldDef.java 13 Oct 2004 11:50:56 -0000 1.6
+++ FieldDef.java 13 Apr 2005 12:48:46 -0000 1.7
@@ -84,6 +84,19 @@
}
}
+ public String getBaseFieldType()
+ {
+ if (_qualifiedType.equals("int") ||
+ _qualifiedType.equals("long") ||
+ _qualifiedType.equals("short"))
+ {
+ return getSimpleType("java.lang.Number");
+ }
+ else
+ {
+ return getFieldType();
+ }
+ }
private static String getSimpleType(String type)
{
1.8 +1 -1 incubator-myfaces/src/codegen/org/apache/myfaces/codegen/resource/Component.vsl
Index: Component.vsl
===================================================================
RCS file: /home/cvs/incubator-myfaces/src/codegen/org/apache/myfaces/codegen/resource/Component.vsl,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Component.vsl 18 May 2004 14:31:39 -0000 1.7
+++ Component.vsl 13 Apr 2005 12:48:46 -0000 1.8
@@ -55,7 +55,7 @@
{
if (_$f.name != null) return _${f.name}.${f.primitiveValueMethod}();
ValueBinding vb = getValueBinding("$f.name");
- ${f.fieldType} v = vb != null ? (${f.fieldType})vb.getValue(getFacesContext())
: null;
+ ${f.baseFieldType} v = vb != null ? (${f.baseFieldType})vb.getValue(getFacesContext())
: null;
$I____#if ($f.defaultValue)
return v != null ? v.${f.primitiveValueMethod}() : DEFAULT_$f.ucaseName;
$I____#else
1.4 +6 -3 incubator-myfaces/src/components/org/apache/myfaces/custom/checkbox/HtmlCheckbox.java
Index: HtmlCheckbox.java
===================================================================
RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/checkbox/HtmlCheckbox.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HtmlCheckbox.java 13 Oct 2004 11:50:57 -0000 1.3
+++ HtmlCheckbox.java 13 Apr 2005 12:48:46 -0000 1.4
@@ -23,6 +23,10 @@
* @author Manfred Geiler (latest modification by $Author$)
* @version $Revision$ $Date$
* $Log$
+ * Revision 1.4 2005/04/13 12:48:46 manolito
+ * MYFACES-186 x:radio and x:checkbox cause ClassCastException
+ * Since the proposed fix is within generated code block, I had to fix the generator instead!
+ *
* Revision 1.3 2004/10/13 11:50:57 matze
* renamed packages to org.apache
*
@@ -82,7 +86,7 @@
{
if (_index != null) return _index.intValue();
ValueBinding vb = getValueBinding("index");
- Integer v = vb != null ? (Integer)vb.getValue(getFacesContext()) : null;
+ Number v = vb != null ? (Number)vb.getValue(getFacesContext()) : null;
return v != null ? v.intValue() : Integer.MIN_VALUE;
}
1.8 +6 -3 incubator-myfaces/src/components/org/apache/myfaces/custom/radio/HtmlRadio.java
Index: HtmlRadio.java
===================================================================
RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/radio/HtmlRadio.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- HtmlRadio.java 13 Oct 2004 11:50:57 -0000 1.7
+++ HtmlRadio.java 13 Apr 2005 12:48:46 -0000 1.8
@@ -23,6 +23,10 @@
* @author Thomas Spiegl (latest modification by $Author$)
* @version $Revision$ $Date$
* $Log$
+ * Revision 1.8 2005/04/13 12:48:46 manolito
+ * MYFACES-186 x:radio and x:checkbox cause ClassCastException
+ * Since the proposed fix is within generated code block, I had to fix the generator instead!
+ *
* Revision 1.7 2004/10/13 11:50:57 matze
* renamed packages to org.apache
*
@@ -91,7 +95,7 @@
{
if (_index != null) return _index.intValue();
ValueBinding vb = getValueBinding("index");
- Integer v = vb != null ? (Integer)vb.getValue(getFacesContext()) : null;
+ Number v = vb != null ? (Number)vb.getValue(getFacesContext()) : null;
return v != null ? v.intValue() : Integer.MIN_VALUE;
}
|