diff --git a/easyexcel-core/src/main/java/com/alibaba/excel/support/ExcelTypeEnum.java b/easyexcel-core/src/main/java/com/alibaba/excel/support/ExcelTypeEnum.java index e78bf94c..03cba5a1 100644 --- a/easyexcel-core/src/main/java/com/alibaba/excel/support/ExcelTypeEnum.java +++ b/easyexcel-core/src/main/java/com/alibaba/excel/support/ExcelTypeEnum.java @@ -11,6 +11,8 @@ import com.alibaba.excel.read.metadata.ReadWorkbook; import com.alibaba.excel.util.StringUtils; import lombok.Getter; + +import org.apache.poi.EmptyFileException; import org.apache.poi.util.IOUtils; /** @@ -87,6 +89,8 @@ public enum ExcelTypeEnum { return recognitionExcelType(inputStream); } catch (ExcelCommonException e) { throw e; + } catch (EmptyFileException e) { + throw new ExcelCommonException("The supplied file was empty (zero bytes long)"); } catch (Exception e) { throw new ExcelCommonException( "Convert excel format exception.You can try specifying the 'excelType' yourself", e);