{
// Convert FALSE back into null
if (submittedValue == Boolean.FALSE)
return null;
UploadedFile file = (UploadedFile) submittedValue;
if(file.getLength() == -1)
{
// There was a failure while one of the UploadedFileProcessor in the chain processed this file,
// we expect the details to be in opaqueData
String errorMessage = file.getOpaqueData().toString();
FacesMessage fm = MessageFactory.getMessage(context,
FacesMessage.SEVERITY_WARN,
"org.apache.myfaces.trinidad.UPLOAD_FAILURE",
new Object[]{errorMessage}, component);
throw new ConverterException(fm);
}
FacesBean bean = getFacesBean(component);
Converter converter = getConverter(component, bean);
// support converter for the <inputFile> component
if(converter != null)
{
// create a unique key (component class name + filename) and use this
// key to add the actual uploaded file to the requestMap
String fileNameKey = component.getClass().getName() + "." + file.getFilename();
context.getExternalContext().getRequestMap().put(fileNameKey, file);
// applying the above convention. The String here is just the
// unique key which the converter has to use to look for the
// actual uploaded file.