You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2024/09/02 15:41:01 UTC
(myfaces-tobago) branch main updated: fix: no logging warning, when no file (#5397)
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
The following commit(s) were added to refs/heads/main by this push:
new d069d0349f fix: no logging warning, when no file (#5397)
d069d0349f is described below
commit d069d0349fcc4c01807b6a232496458d86c0bcb1
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Mon Sep 2 17:40:55 2024 +0200
fix: no logging warning, when no file (#5397)
issue: TOBAGO-2346
---
.../myfaces/tobago/internal/renderkit/renderer/FileRenderer.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java
index bfb5535d07..a1f0fd8665 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java
@@ -45,7 +45,6 @@ import jakarta.faces.event.PostAddToViewEvent;
import jakarta.faces.validator.Validator;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.Part;
-
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
@@ -95,7 +94,9 @@ public class FileRenderer<T extends AbstractUIFile>
final String fileName = part.getSubmittedFileName();
final String contentType = part.getContentType();
LOG.debug("Uploaded file '{}', size={}, type='{}'.", fileName, part.getSize(), contentType);
- if (StringUtils.isBlank(fileName)) {
+ if (part.getSize() == 0) {
+ LOG.debug("Ignoring empty file for clientId='{}'.", clientId);
+ } else if (StringUtils.isBlank(fileName)) {
LOG.warn("No fileName provided for clientId='{}'.", clientId);
} else if (StringUtils.isBlank(contentType)) {
LOG.warn("No contentType provided for clientId='{}'.", clientId);