From af2c3882624d0451f08b5a9c7ed0e74ab5343594 Mon Sep 17 00:00:00 2001 From: zl Date: Wed, 20 Nov 2019 18:31:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89LongestMatchColumnWidthStyleS?= =?UTF-8?q?trategy=E7=BC=93=E5=AD=98=E7=9A=84static=E4=BF=AE=E9=A5=B0?= =?UTF-8?q?=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/column/LongestMatchColumnWidthStyleStrategy.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/alibaba/excel/write/style/column/LongestMatchColumnWidthStyleStrategy.java b/src/main/java/com/alibaba/excel/write/style/column/LongestMatchColumnWidthStyleStrategy.java index 5140ae68..38a6dbb2 100644 --- a/src/main/java/com/alibaba/excel/write/style/column/LongestMatchColumnWidthStyleStrategy.java +++ b/src/main/java/com/alibaba/excel/write/style/column/LongestMatchColumnWidthStyleStrategy.java @@ -24,7 +24,7 @@ public class LongestMatchColumnWidthStyleStrategy extends AbstractColumnWidthSty private static final int MAX_COLUMN_WIDTH = 255; - private static final Map> CACHE = new HashMap>(8); + private final Map> cache = new HashMap>(8); @Override protected void setColumnWidth(WriteSheetHolder writeSheetHolder, List cellDataList, Cell cell, Head head, @@ -33,10 +33,10 @@ public class LongestMatchColumnWidthStyleStrategy extends AbstractColumnWidthSty if (!needSetWidth) { return; } - Map maxColumnWidthMap = CACHE.get(writeSheetHolder.getSheetNo()); + Map maxColumnWidthMap = cache.get(writeSheetHolder.getSheetNo()); if (maxColumnWidthMap == null) { maxColumnWidthMap = new HashMap(16); - CACHE.put(writeSheetHolder.getSheetNo(), maxColumnWidthMap); + cache.put(writeSheetHolder.getSheetNo(), maxColumnWidthMap); } Integer columnWidth = dataLength(cellDataList, cell, isHead); if (columnWidth < 0) {