[
https://issues.apache.org/jira/browse/MYFACES-3599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13445932#comment-13445932
]
Mike Kienenberger commented on MYFACES-3599:
--------------------------------------------
Can you post the full stack trace, please, or at least the parts that
immediately proceed the error, which include MyFaces classes?
> 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