[richfaces-issues] [JBoss JIRA] (RF-11882) a4j jsFunction cannot transform java class to json in the getData method call
Brian Leathem (JIRA)
jira-events at lists.jboss.org
Tue Feb 14 12:21:04 EST 2012
[ https://issues.jboss.org/browse/RF-11882?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12666476#comment-12666476 ]
Brian Leathem commented on RF-11882:
------------------------------------
Dirk Dollar,
Without the associated facelet page, we are unable to reproduce this error.
> a4j jsFunction cannot transform java class to json in the getData method call
> -----------------------------------------------------------------------------
>
> Key: RF-11882
> URL: https://issues.jboss.org/browse/RF-11882
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 4.1.0.Final
> Reporter: Dirk Dollar
> Priority: Minor
> Labels: waiting_on_user
>
> I get a
> FATAL:
> {code}
> ...javax.faces.FacesException: Error in conversion Java Object to JavaScript
> at org.ajax4jsf.javascript.ScriptUtils.appendScript(ScriptUtils.java:194) [:4.1.0.Final]
> at org.ajax4jsf.javascript.ScriptUtils.appendScript(ScriptUtils.java:123) [:4.1.0.Final]
> ....
> Caused by: java.lang.IllegalAccessException: Class org.ajax4jsf.javascript.PropertyUtils can not access a member of class java.util.HashMap$Entry with modifiers "public final"
> {code}
> Which wasn't there in richfaces 3.3.3
> The code snippet:
> {code}
> class MyBean{
> public String actionMethod(){
> ....do something which creates a Map <String,String> data, now I want to sort it before I return it:
> private List<Entry<String, String>> sortDataIntoList(Map<String, String> data) {
> List<Entry<String, String>> sortedList = new ArrayList<Entry<String, String>>(data.entrySet());
> Collections.sort(sortedList, new Comparator<Entry<String, String>>() {
> public int compare(Entry<String, String> f1, Entry<String, String> f2) {
> return f1.getValue().compareTo(f2.getValue());
> }
> });
> if(sortedList.size()>max)
> return sortedList.subList(0, max);
> return sortedList;
> }
> ...and return it from...
> public static MyInnerClass{
> List<Entry<String,String>> data
> public MyInnerClass(List<Entry<String,String>> data){
> this.data=data
> }
> public List<Entry<String,String>> getData(){
> return data;}
> }
> }
> {code}
> results in the mentioned error
> A possible workaround is to use one's own implementation of a key value object e.g. something like
> http://stackoverflow.com/questions/521171/a-java-collection-of-value-pairs-tuples
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the richfaces-issues
mailing list