From 7e02d41c347e7fd1fa3fecbb6db12cfa41636f90 Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Mon, 4 Oct 2010 08:45:51 +0000 Subject: [PATCH] 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 --- src/documentation/content/xdocs/status.xml | 1 + .../apache/poi/hssf/model/RecordOrderer.java | 2 ++ .../apache/poi/hssf/record/UnknownRecord.java | 1 + .../org/apache/poi/hssf/usermodel/TestBugs.java | 8 ++++++++ test-data/spreadsheet/50020.xls | Bin 0 -> 16384 bytes 5 files changed, 12 insertions(+) create mode 100644 test-data/spreadsheet/50020.xls 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 0000000000000000000000000000000000000000..9f4001ef28da94ae73214fc1548069f9a15842ad GIT binary patch literal 16384 zcmeHOeRx#WnLqc=B$<5S5CQ@LyqN(EA4%`r$)^y>%w&>)2@?qrKVriqxq*>MCY?+$ z3e*Ycmfg~dLTlH$6}Q_~>((N4ZMD`0AG^C&-EA%Yq5c7_?$++J`{?#*ciTSd?C(AI z-prk35+)SuQaQ=*o^#*xp0D?u_dOr?%uoJx?zxAbSp0J~$z97V?1Mxu%Qn#kgbCc) z850p8e2_>aG$LaNUUrv|1l~toZRosWzzSpm)aN-sE-)9!1M-0apb(e?TmfJRup(dy zFb|jy&{$Xi|4LvXun1TTlmJTsieIMtmynqLY^%D3MerA667#b`_)&H{dM9(Y03*f_ z4%q_9Mo-4Z`I9w~7kyw$Z$<4kid>6G<;fKhnAO#{YTS+XXU(Pj-RCG?V_5eIOe^`cF25 zY`}E-Pj-TA0O|i#fCQ8R4!{X42gp9GgnuB18ab_KsitWd;*{$GUfE$6EfSZ9X;1=MMKsT@h2m(DoFVF{2`hNI3fn7idxD_DH2m=Ga zAP@nDfKLHYfYQa_j{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