From: Yegor Kozlov Date: Fri, 10 Aug 2007 17:34:57 +0000 (+0000) Subject: Bug 43090: autoSizeColumn can calculate negative sizes for the column width due to... X-Git-Tag: REL_3_0_2_BETA1~69 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ac9e1ffdcb1b189693b206291490ca2586d82330;p=poi.git Bug 43090: autoSizeColumn can calculate negative sizes for the column width due to a cast from integer to short git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@564689 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index 59a31213eb..def2e75a18 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -1505,6 +1505,9 @@ public class HSSFSheet } if (width != -1) { + if (width > Short.MAX_VALUE) { //width can be bigger that Short.MAX_VALUE! + width = Short.MAX_VALUE; + } sheet.setColumnWidth(column, (short) (width * 256)); } }