myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ertio Lew (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Commented] (MYFACES-3599) Using Collections.EMPTY_LIST inside converter leads to IllegalAccessException
Date Fri, 31 Aug 2012 18:39:07 GMT

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

Ertio Lew commented on MYFACES-3599:
------------------------------------

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 leads 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

Mime
View raw message