• SimpleValuePicker - Problem with restore state

    By Serdar Basegmez 1 decade ago

    A simple value picker like;

     

    <xe:valuePicker id="valuePicker2" for="inputText1">
    
    <xe:this.dataProvider>
    
    <xe:simpleValuePicker valueList="${javascript:return ['a', 'b', 'c']}"></xe:simpleValuePicker>
    
    </xe:this.dataProvider>
    
    </xe:valuePicker>
    

    generates the following exception:

     

    java.lang.ClassCastException: java.util.Vector incompatible with java.lang.String
    
    at com.ibm.xsp.extlib.component.picker.data.SimpleValuePickerData.restoreState(SimpleValuePickerData.java:122)
    
    at com.ibm.xsp.util.SerializableState.restore(SerializableState.java:79)
    
    at com.ibm.xsp.util.FacesUtil.objectFromSerializable(FacesUtil.java:1435)
    
    at com.ibm.xsp.extlib.component.picker.UIValuePicker.restoreState(UIValuePicker.java:59)
    
    at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1381)
    
    at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1395)
    
    at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1395)
    
    .....
    

    It works if you use #{...} but not with ${...}. On the source code, we can see the problem;

     

     

        @Override
    
        public void restoreState(FacesContext _context, Object _state) {
    
            Object _values[] = (Object[]) _state;
    
            super.restoreState(_context, _values[0]);
    
    <strong>&nbsp; &nbsp; &nbsp; &nbsp; valueList = (String)_values[1];</strong></div>
    
    &nbsp; &nbsp; &nbsp; &nbsp; valueListSeparator = (String)_values[2];
    
    &nbsp; &nbsp; &nbsp; &nbsp; labelSeparator = (String)_values[3];
    
    &nbsp; &nbsp; &nbsp; &nbsp; caseInsensitive = (Boolean)_values[4];
    
    &nbsp; &nbsp; }
    
    &nbsp;
    

    There is a wrong casting.

    • Issue has been logged

      By lisa henry 1 decade ago

      SPR # LHEY953MCR: ExtLib | Wrong casting on value picker causing exception when using $ has been logged for further reference