说明:如果sheet 定义在try中,就会报错,即使方法能返回sheet ,因为定义在了try中也会报错。
所以开发中,try中能不定义就不定义
XSSFSheet sheet = null;
try {
log.debug(UtilDateTime.getTimestamp(System.currentTimeMillis()) + ".readExcel.start...constantsvariable={}",
constantsvariable.getSheet());
sheet = constantsvariable.getSheet();
} catch (Exception e) {
log.error(UtilDateTime.getTimestamp(System.currentTimeMillis()) + ".readExcel.exception....异常...异常信息:{}",
e);
throw new Exception(
UtilDateTime.getTimestamp(System.currentTimeMillis()) + ".readExcel.exception....异常...异常信息:{}", e);
}
log.debug(UtilDateTime.getTimestamp(System.currentTimeMillis()) + ".readExcel.end...读取结束无异常");
}