From: Yegor Kozlov Date: Mon, 4 Oct 2010 08:45:51 +0000 (+0000) Subject: Avoid IllegalStateException when creating Data validation in sheet with macro, see... X-Git-Tag: POI-3.7~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7e02d41c347e7fd1fa3fecbb6db12cfa41636f90;p=poi.git Avoid IllegalStateException when creating Data validation in sheet with macro, see Bugzilla 50020 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1004143 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 27aa73f5fd..94337a2b84 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 50020 - Avoid IllegalStateException when creating Data validation in sheet with macro 50033 - Improved rounding in MOD Generate SHA1 hashes of distribution files, alongside existing MD5 ones diff --git a/src/java/org/apache/poi/hssf/model/RecordOrderer.java b/src/java/org/apache/poi/hssf/model/RecordOrderer.java index 31c25db850..b7d942e5dc 100644 --- a/src/java/org/apache/poi/hssf/model/RecordOrderer.java +++ b/src/java/org/apache/poi/hssf/model/RecordOrderer.java @@ -333,6 +333,8 @@ final class RecordOrderer { // ConditionalFormattingTable case HyperlinkRecord.sid: case UnknownRecord.QUICKTIP_0800: + // name of a VBA module + case UnknownRecord.CODENAME_1BA: return true; } return false; diff --git a/src/java/org/apache/poi/hssf/record/UnknownRecord.java b/src/java/org/apache/poi/hssf/record/UnknownRecord.java index 3e04d0f8bf..963810f745 100644 --- a/src/java/org/apache/poi/hssf/record/UnknownRecord.java +++ b/src/java/org/apache/poi/hssf/record/UnknownRecord.java @@ -57,6 +57,7 @@ public final class UnknownRecord extends StandardRecord { public static final int SHEETEXT_0862 = 0x0862; // OOO calls this SHEETLAYOUT public static final int SHEETPROTECTION_0867 = 0x0867; public static final int HEADER_FOOTER_089C = 0x089C; + public static final int CODENAME_1BA = 0x01BA; private int _sid; private byte[] _rawData; diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index 7c83d0b4a1..a851ba15ae 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -1886,4 +1886,12 @@ if(1==2) { "BlahBlah blah blah ", f.getCenter() ); } + + /** + * IllegalStateException received when creating Data validation in sheet with macro + */ + public void test50020() throws Exception { + HSSFWorkbook wb = openSample("50020.xls"); + writeOutAndReadBack(wb); + } } diff --git a/test-data/spreadsheet/50020.xls b/test-data/spreadsheet/50020.xls new file mode 100644 index 0000000000..9f4001ef28 Binary files /dev/null and b/test-data/spreadsheet/50020.xls differ