diff --git a/common/src/main/java/com/jeesite/common/utils/excel/ExcelExport.java b/common/src/main/java/com/jeesite/common/utils/excel/ExcelExport.java index 95453534..6819993e 100644 --- a/common/src/main/java/com/jeesite/common/utils/excel/ExcelExport.java +++ b/common/src/main/java/com/jeesite/common/utils/excel/ExcelExport.java @@ -18,7 +18,6 @@ import java.util.Map; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Comment; @@ -37,11 +36,13 @@ import org.slf4j.LoggerFactory; import com.fasterxml.jackson.annotation.JsonFormat; import com.jeesite.common.codec.EncodeUtils; import com.jeesite.common.collect.ListUtils; +import com.jeesite.common.lang.ObjectUtils; +import com.jeesite.common.lang.StringUtils; import com.jeesite.common.reflect.ReflectUtils; import com.jeesite.common.utils.excel.annotation.ExcelField; import com.jeesite.common.utils.excel.annotation.ExcelField.Align; -import com.jeesite.common.utils.excel.annotation.ExcelFields; import com.jeesite.common.utils.excel.annotation.ExcelField.Type; +import com.jeesite.common.utils.excel.annotation.ExcelFields; /** * 导出Excel文件(导出“XLSX”格式,支持大数据量导出 @see org.apache.poi.ss.SpreadsheetVersion) @@ -474,7 +475,7 @@ public class ExcelExport { // } } catch (Exception ex) { log.info("Set cell value ["+row.getRowNum()+","+column+"] error: " + ex.toString()); - cell.setCellValue(val.toString()); + cell.setCellValue(ObjectUtils.toString(val)); } return cell; } diff --git a/common/src/main/java/com/jeesite/common/utils/word/BookMark.java b/common/src/main/java/com/jeesite/common/utils/word/BookMark.java index d827b01b..d46228c9 100644 --- a/common/src/main/java/com/jeesite/common/utils/word/BookMark.java +++ b/common/src/main/java/com/jeesite/common/utils/word/BookMark.java @@ -464,14 +464,14 @@ public class BookMark { // Get the first node and catch it's reference for return if // the first child node is a style node (w:rPr). childNode = parentNode.getFirstChild(); - if (childNode.getNodeName().equals("w:rPr")) { + if (childNode != null && childNode.getNodeName().equals("w:rPr")) { styleNode = childNode; } else { // If the first node was not a style node and there are other // child nodes remaining to be checked, then step through // the remaining child nodes until either a style node is // found or until all child nodes have been processed. - while ((childNode = childNode.getNextSibling()) != null) { + while (childNode != null && (childNode = childNode.getNextSibling()) != null) { if (childNode.getNodeName().equals(BookMark.STYLE_NODE_NAME)) { styleNode = childNode; // Note setting to null here if a style node is diff --git a/common/src/main/java/com/jeesite/common/utils/word/WordExport.java b/common/src/main/java/com/jeesite/common/utils/word/WordExport.java index 3eb88a9d..821db15f 100644 --- a/common/src/main/java/com/jeesite/common/utils/word/WordExport.java +++ b/common/src/main/java/com/jeesite/common/utils/word/WordExport.java @@ -221,8 +221,12 @@ public class WordExport { e.printStackTrace(); } finally { try { - fos.flush(); - fos.close(); + if (fos != null){ + fos.flush(); + } + if (fos != null){ + fos.close(); + } } catch (IOException e) { e.printStackTrace(); } diff --git a/common/src/test/java/com/jeesite/test/HttpClientTest.java b/common/src/test/java/com/jeesite/test/HttpClientTest.java deleted file mode 100644 index 8e4b9264..00000000 --- a/common/src/test/java/com/jeesite/test/HttpClientTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.jeesite.test; - -import java.util.Map; - -import com.jeesite.common.collect.MapUtils; -import com.jeesite.common.web.http.HttpClientUtils; - -public class HttpClientTest { - - public static void main(String[] args) { - - String url = "http://:8080/multData/a/login"; - - Map map = MapUtils.newHashMap(); - - map.put("currentDataSource", "86fecee8d2e04bbe8e6c23dff9338f66"); - map.put("mobileLogin", "true"); - map.put("username", "system"); - map.put("password", "admin"); - - String res = HttpClientUtils.ajaxPost(url, map); - System.out.println(res); - - } -}