}
if (!(component instanceof ValueHolder)) {
// TODO Message resource i18n
throw new JspException("Component "+ component.getClass().getName() + " is not instanceof ValueHolder");
}
ValueHolder valueHolder = (ValueHolder) component;
Converter converter = null;
if (binding != null && UIComponentTag.isValueReference(binding)) {
ValueBinding valueBinding = ComponentUtil.createValueBinding(binding);
if (valueBinding != null) {
Object obj = valueBinding.getValue(FacesContext.getCurrentInstance());
if (obj != null && obj instanceof Converter) {
converter = (Converter) obj;
}
}
}
if (converter == null && converterId != null) {
String localConverterId;
// evaluate any VB expression that we were passed
if (UIComponentTag.isValueReference(converterId)) {
ValueBinding typeValueBinding = ComponentUtil.createValueBinding(converterId);
localConverterId = (String) typeValueBinding.getValue(FacesContext.getCurrentInstance());
} else {
localConverterId = converterId;
}
converter = FacesContext.getCurrentInstance().getApplication().createConverter(localConverterId);
if (converter != null && binding != null) {
ComponentUtil.setValueForValueBinding(binding, converter);
}
}
if (converter != null) {
if (UIComponentTag.isValueReference(binding)) {
component.setValueBinding(ATTR_CONVERTER, ComponentUtil.createValueBinding(binding));
} else {
valueHolder.setConverter(converter);
}
}
// TODO else LOG.warn?
return (SKIP_BODY);
}