Skip to content

Commit

Permalink
Fix primefaces#11806: FileUpload switch error to dev warning
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Apr 26, 2024
1 parent e87d4a9 commit b24c879
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,24 @@
import javax.faces.convert.ConverterException;
import java.io.IOException;
import java.util.Arrays;
import java.util.logging.Logger;

public class FileUploadRenderer extends CoreRenderer {

private static final Logger LOGGER = Logger.getLogger(FileUploadRenderer.class.getName());

@Override
public void decode(FacesContext context, UIComponent component) {
FileUpload fileUpload = (FileUpload) component;
if (!fileUpload.isDisabled()) {
if (!context.getExternalContext().getRequestContentType().toLowerCase().startsWith("multipart/")) {
LOGGER.severe(() -> "Decoding FileUpload requires contentType \"multipart/form-data\"." +
" Skipping clientId: " + component.getClientId(context));
return;
}
if (fileUpload.isDisabled()) {
return;
}
if (!context.getExternalContext().getRequestContentType().toLowerCase().startsWith("multipart/")) {
logDevelopmentWarning(context,
"Decoding FileUpload requires contentType \"multipart/form-data\" for clientId: " + component.getClientId(context));
}

PrimeApplicationContext applicationContext = PrimeApplicationContext.getCurrentInstance(context);
PrimeApplicationContext applicationContext = PrimeApplicationContext.getCurrentInstance(context);

FileUploadDecoder decoder = applicationContext.getFileUploadDecoder();
decoder.decode(context, fileUpload);
}
FileUploadDecoder decoder = applicationContext.getFileUploadDecoder();
decoder.decode(context, fileUpload);
}

@Override
Expand Down

0 comments on commit b24c879

Please sign in to comment.