You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Ertio Lew (JIRA)" <de...@myfaces.apache.org> on 2012/08/31 20:43:11 UTC

[jira] [Comment Edited] (MYFACES-3599) Using Collections.EMPTY_LIST inside converter lead to IllegalAccessException

    [ https://issues.apache.org/jira/browse/MYFACES-3599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13446222#comment-13446222 ] 

Ertio Lew edited comment on MYFACES-3599 at 9/1/12 5:41 AM:
------------------------------------------------------------

Actually this runtime exception was not logged in my logs but instead I saw it in firebug as a postback response which included only this much detail.
                
      was (Author: ertiop93):
    Actually this runtime exception was not logged in my logs but instead I saw it in firebug as the postback response which included only this much response.
                  
> Using Collections.EMPTY_LIST inside converter lead to IllegalAccessException
> ----------------------------------------------------------------------------
>
>                 Key: MYFACES-3599
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3599
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.1.8
>         Environment: Glassfish 3.1 & JUEL EL Implementation
>            Reporter: Ertio Lew
>
> While using a string->list(& viceversa) converter, I made use of Collections.EMPTY_LIST but it gives the following error. (This worked fine with Mojarra)
> <error>
> <error-name>java.lang.IllegalStateException</error-name>
> <error-message>java.lang.RuntimeException: java.lang.IllegalAccessException: Class javax.faces.component.UIComponentBase can not access a member of class java.util.Collections$EmptyList with modifiers "private"</error-message>
> </error>
>  Why cannot I use Collections.EMPTY_LIST but replacing with new ArrayList<Integer>() just works ?
> Converter code as follows:
> ------------------
> FacesConverter(value = "listConverter", forClass = px10.Utils.ListConverter.class)
> public class ListConverter implements Converter {
>     
>     @Override
>     public Object getAsObject(FacesContext fc, UIComponent uic, String stringVal) {
>         if (stringVal==null) 
>             return Collections.EMPTY_LIST; 
>         
>         String[] split = stringVal.split(",");
>         List<Integer> list = new ArrayList<Integer>(split.length);
>         for (int i = 0; i < split.length; i++) {
>             list.add(Integer.parseInt(split[i]));
>         }
>         return list;
>     }
>     ...
>     ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira