[
http://issues.apache.org/jira/browse/MYFACES-715?page=comments#action_12332409
]
Jon Travis commented on MYFACES-715:
------------------------------------
Example patch included (it's like 2 lines).
The more important thing, IMO is that we have nearly duplicate code in 2
locations. This
is just asking for trouble later down the road (and here, we can see that the
code was
actually different between the 2 classes). We should automate the generation
of the
classes if we need something like this.
-- Jon
Index: share/src/java/org/apache/myfaces/renderkit/_SharedRendererUtils.java
===================================================================
--- share/src/java/org/apache/myfaces/renderkit/_SharedRendererUtils.java
(revision 292567)
+++ share/src/java/org/apache/myfaces/renderkit/_SharedRendererUtils.java
(working copy)
@@ -141,8 +141,10 @@
// ...but have no idea of expected type
// --> so let's convert it to an Object array
int len = submittedValue.length;
- Object [] convertedValues = (Object []) Array.newInstance(
-
arrayComponentType==null?Object[].class:arrayComponentType,len);
+
+ //Object [] convertedValues = (Object []) Array.newInstance(
+ //arrayComponentType==null?Object[].class:arrayComponentType,len);
+ Object [] convertedValues = new Object[len];
for (int i = 0; i < len; i++)
{
convertedValues[i]
Index: api/src/java/javax/faces/component/_SharedRendererUtils.java
===================================================================
--- api/src/java/javax/faces/component/_SharedRendererUtils.java
(revision 292567)
+++ api/src/java/javax/faces/component/_SharedRendererUtils.java
(working copy)
@@ -136,7 +136,8 @@
// ...but have no idea of expected type
// --> so let's convert it to an Object array
int len = submittedValue.length;
- Object [] convertedValues = (Object [])
Array.newInstance(arrayComponentType, len);
+ //Object [] convertedValues = (Object [])
Array.newInstance(arrayComponentType, len);
+ Object[] convertedValues = new Object[len];
for (int i = 0; i < len; i++)
{
convertedValues[i]
> ArrayStoreException in _SharedRendererUtils.getConvertedUISelectManyValue()
> ---------------------------------------------------------------------------
>
> Key: MYFACES-715
> URL: http://issues.apache.org/jira/browse/MYFACES-715
> Project: MyFaces
> Type: Bug
> Components: Implementation
> Versions: Nightly
> Environment: JBoss 4, Windows XP, MyFaces nightly build for 20051016
> Reporter: Ampie Barnard
>
> I get the following exception when submitting values for a UISelectMany:
> java.lang.ArrayStoreException: businesssaver.segment.Segment
> at
> org.apache.myfaces.renderkit._SharedRendererUtils.getConvertedUISelectManyValue(_SharedRendererUtils.java:148)
> at
> org.apache.myfaces.renderkit.RendererUtils.getConvertedUISelectManyValue(RendererUtils.java:680)
> at
> org.apache.myfaces.renderkit.html.HtmlListboxRendererBase.getConvertedValue(HtmlListboxRendererBase.java:127)
> at
> javax.faces.component.UISelectMany.getConvertedValue(UISelectMany.java:344)
> at javax.faces.component.UIInput.validate(UIInput.java:265)
> at javax.faces.component.UISelectMany.validate(UISelectMany.java:333)
> After further inspection, the following two lines seem to be the culprit.
> Line 144:
> Object [] convertedValues = (Object []) Array.newInstance(
>
> arrayComponentType==null?Object[].class:arrayComponentType,len);
> They result in the creation of an array of arrays of objects - Object[][],
> resulting in an incorrect assignment
> of an object where an array of objects is expected:
> Line 148:
> convertedValues[i]
> = converter.getAsObject(facesContext, component,
> submittedValue[i]);
> I apologise for not sending a patch, but unfortunately our co's firewall does
> not allow me checkout from CVS
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira