Ertio Lew created MYFACES-3599:
----------------------------------

             Summary: 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 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

Reply via email to