You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (JIRA)" <ji...@apache.org> on 2017/08/18 07:04:00 UTC
[jira] [Commented] (WICKET-6451) Real Exception while setting model
object is hidden
[ https://issues.apache.org/jira/browse/WICKET-6451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16131826#comment-16131826 ]
Sven Meier commented on WICKET-6451:
------------------------------------
We could improve support for different collection types. For this Wicket will have to create a suitable collection, e.g. in a new method in Objects:
{code}
/**
* Creates a new collection.
*
* @param hint type deciding the type of the returned collection
* @return collection
* @throws IllegalArgumentException if type is not supported
*/
public static <S> Collection<S> newCollection(Class<?> hint)
{
if (Set.class.isAssignableFrom(hint)) {
return new HashSet<>();
} if (List.class.isAssignableFrom(hint)) {
return new ArrayList<>();
} else {
throw new IllegalArgumentException("unsupported type '" + hint + "'");
}
}
{code}
> Real Exception while setting model object is hidden
> ---------------------------------------------------
>
> Key: WICKET-6451
> URL: https://issues.apache.org/jira/browse/WICKET-6451
> Project: Wicket
> Issue Type: Improvement
> Components: wicket
> Affects Versions: 8.0.0-M6
> Reporter: Kamil
> Assignee: Sven Meier
> Priority: Minor
> Attachments: showcase-hiddenException.zip
>
>
> When object returns Collections.unmodifiableSet() it is obvious that model object can not be updated.
> But the exception that was thrown causes me to spend hours until I found out that:
> {code}
> Last cause: Could not convert value: [] to type: java.util.Set. Could not find compatible converter.
> WicketMessage: An error occurred while trying to set the collection attached to [BootstrapMultiSelect [Component id = children]]
> {code}
> Is not about converter but about unmodifialble set, because the real exception was hidden!
> 1)Run the app
> 2)Click submit
> 3)Caused by User#L30
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)