View Full Version : SimpleComboBox assumes that type is String in getSimpleValue when getValue is null

2 Mar 2011, 8:42 PM
I've been using SimpleComboBox to display enums but I've been getting ClassCastExceptions on and off when binding stuff to forms (I have a custom FormBinding that uses the other FieldBindings -TimeField and SimpleComboBox- plus a custom one for RadioGroups). However, it wasn't until now that I figured out the problem is inside the getSimpleValue method.

public T getSimpleValue() {
SimpleComboValue<T> c = getValue();
if (c != null) {
return c.<T> get("value");
try {
return (T) getRawValue();
} catch (Exception e) {
return null;


If getValue returns null, it incorrectly assumes that it can cast the String value returned by getRawValue to whatever type is in the generics. This seems unnecessary anyways as getValue checks the raw value against what is in the store. I've overriden it anyways in an extended class I have for behavior I want such as how it appears when readOnly and such, but this probably needs a fix in regular GXT and should probably just return null.