[ 
https://issues.apache.org/jira/browse/TAP5-609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12695733#action_12695733
 ] 

Shing Hing Man commented on TAP5-609:
-------------------------------------


I have worked out the cause of the  error. 

In my Loop component, the source parameter is set to Double[][] and the 
parameter encoder is not set.

In 5.0.18 Loop.java, when the encoder parameter is null (not provided), 
it will store  each element (of type Double[] in our case) of the source.


In 5.1.0.2 Loop.java, when the encoder parameter is not provided, it  will try 
to find a ValueEncoder for
 Double[].
As there is no ValueEncoder in the framework that handles Double[], an 
exception is thrown.

A fix is to provide a custom ValueEncoder to my Loop component to handle 
Double[].


In general, as it is, if there is no built-in ValueEncoder for the type of 
elements in the collection 
specified in the source parameter, an exception on not finding a ValueEncoder 
will be thrown.
Is this a bug or feature ?
  

> Type Coercion problem in 5.1.0.2 snapshot
> -----------------------------------------
>
>                 Key: TAP5-609
>                 URL: https://issues.apache.org/jira/browse/TAP5-609
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.1.0.2
>            Reporter: Shing Hing Man
>            Priority: Minor
>         Attachments: myapp.jar
>
>
> I have a component which uses two nested loop to input a two dimensional 
> array of Doubles. It works in Tapestry 5.0.18. In Tapestry 5.1.0.2 snapshot, 
> when I submit the form containing the above component, I get the following 
> error message.
> Could not find a coercion from type java.lang.String to type 
> [Ljava.lang.Double;. Available coercions: Double --> Float, Float --> Double, 
> Long --> Boolean, Long --> Byte, Long --> Double, Long --> Integer, Long --> 
> Short, Number --> Long, Object --> Object[], Object --> String, Object --> 
> java.util.List, Object[] --> java.util.List, String --> Boolean, String --> 
> Double, String --> Long, String --> java.io.File, String --> 
> java.math.BigDecimal, String --> java.math.BigInteger, String --> 
> java.text.DateFormat, String --> java.util.regex.Pattern, String --> 
> org.apache.tapestry5.Renderable, String --> org.apache.tapestry5.SelectModel, 
> String --> org.apache.tapestry5.corelib.data.BlankOption, String --> 
> org.apache.tapestry5.corelib.data.GridPagerPosition, String --> 
> org.apache.tapestry5.corelib.data.InsertPosition, String --> 
> org.apache.tapestry5.ioc.Resource, String --> 
> org.apache.tapestry5.ioc.util.TimeInterval, boolean[] --> java.util.List, 
> byte[] --> java.util.List, char[] --> java.util.List, double[] --> 
> java.util.List, float[] --> java.util.List, int[] --> java.util.List, 
> java.math.BigDecimal -
> # 
> org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl.findOrCreateCoercion(TypeCoercerImpl.java:244)
> # 
> org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl.access$000(TypeCoercerImpl.java:29)
> # 
> org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl$TargetCoercion.getCoercion(TypeCoercerImpl.java:88)
> # 
> org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl$TargetCoercion.coerce(TypeCoercerImpl.java:61)
> # 
> org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl.coerce(TypeCoercerImpl.java:133)
> # $TypeCoercer_1204ea4852e.coerce($TypeCoercer_1204ea4852e.java)
> # 
> org.apache.tapestry5.internal.services.TypeCoercedValueEncoderFactory$1.toValue(TypeCoercedValueEncoderFactory.java:45)
> # 
> org.apache.tapestry5.corelib.components.Loop.restoreStateFromStoredClientValue(Loop.java:423)
> # org.apache.tapestry5.corelib.components.Loop.access$500(Loop.java:41)
> # 
> org.apache.tapestry5.corelib.components.Loop$RestoreStateFromStoredClientValue.execute(Loop.java:162)
> # 
> org.apache.tapestry5.corelib.components.Loop$RestoreStateFromStoredClientValue.execute(Loop.java:151)
> # 
> org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:477)
> # 
> org.apache.tapestry5.corelib.components.Form._$advised$onAction(Form.java:375)
> # 
> org.apache.tapestry5.corelib.components.Form$onAction$invocation_1204ea4f004.invokeAdvisedMethod(Form$onAction$invocation_1204ea4f004.java)
> # 
> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:71)
> # 
> org.apache.tapestry5.ioc.internal.services.LoggingAdvice.advise(LoggingAdvice.java:37)
> # 
> org.apache.tapestry5.internal.transform.LogWorker$1.advise(LogWorker.java:54)
> # 
> org.apache.tapestry5.internal.services.AbstractComponentMethodInvocation.proceed(AbstractComponentMethodInvocation.java:80)
> # org.apache.tapestry5.corelib.components.Form.onAction(Form.java) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to