From d667569390b3bdbc63184f3f987aa8b695968465 Mon Sep 17 00:00:00 2001 From: wangkang Date: Wed, 31 May 2017 11:07:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E4=BB=B6ID=E5=88=A4?= =?UTF-8?q?=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/egridcloud/udf/file/service/FileService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/udf-starter-file/src/main/java/com/egridcloud/udf/file/service/FileService.java b/udf-starter-file/src/main/java/com/egridcloud/udf/file/service/FileService.java index f97158d..841d3a9 100644 --- a/udf-starter-file/src/main/java/com/egridcloud/udf/file/service/FileService.java +++ b/udf-starter-file/src/main/java/com/egridcloud/udf/file/service/FileService.java @@ -14,6 +14,7 @@ import java.util.Date; import javax.activation.FileTypeMap; import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.FileSystemResource; import org.springframework.stereotype.Service; @@ -60,6 +61,10 @@ public class FileService { * @throws IOException 异常 */ public FileInfo getFileInfo(String fileId) throws IOException { + //判断fileId是否为空 + if (StringUtils.isBlank(fileId)) { + throw new FileException("fileId can not be empty"); + } //返回对象 FileInfo result = new FileInfo(); result.setId(fileId);