2
0

feat: file module support i18n message

This commit is contained in:
zhangsz
2025-01-22 10:40:02 +08:00
parent 96bd946635
commit 575e101082
4 changed files with 8 additions and 1 deletions

View File

@@ -123,6 +123,8 @@ job.cron.not.blank=Cron expression cannot be blank
job.cron.length.valid=Cron expression length cannot exceed 255 characters
job.execute.success=The scheduled task was executed successfully, the time taken: {0} milliseconds
job.execute.spend.time=the time taken: {0} milliseconds
## wfc-file
file.cannot.null=File must not be null or empty
## wfc-common
common.operate.success=Operation successful

View File

@@ -123,6 +123,8 @@ job.cron.not.blank=Cron expression cannot be blank
job.cron.length.valid=Cron expression length cannot exceed 255 characters
job.execute.success=The scheduled task was executed successfully, the time taken: {0} milliseconds
job.execute.spend.time=the time taken: {0} milliseconds
## wfc-file
file.cannot.null=File must not be null or empty
## wfc-common
common.operate.success=Operation successful

View File

@@ -124,6 +124,8 @@ job.cron.not.blank=Cron表达式不能为空
job.cron.length.valid=Cron执行表达式不能超过255个字符
job.execute.success=定时任务执行成功, 耗时:{0} 毫秒
job.execute.spend.time=总共耗时:{0} 毫秒
## wfc-file
file.cannot.null=文件不能为空
## wfc-common
common.operate.success=操作成功

View File

@@ -11,6 +11,7 @@ import org.wfc.common.core.exception.file.FileNameLengthLimitExceededException;
import org.wfc.common.core.exception.file.FileSizeLimitExceededException;
import org.wfc.common.core.exception.file.InvalidExtensionException;
import org.wfc.common.core.utils.DateUtils;
import org.wfc.common.core.utils.MessageUtils;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.file.FileTypeUtils;
import org.wfc.common.core.utils.file.MimeTypeUtils;
@@ -66,7 +67,7 @@ public class FileUploadUtils {
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
InvalidExtensionException {
if (file == null || file.isEmpty()) {
throw new IllegalArgumentException("File must not be null or empty");
throw new IllegalArgumentException(MessageUtils.message("file.cannot.null"));
}
int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {