diff options
author | Nick Burch <nick@apache.org> | 2014-11-30 17:09:03 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2014-11-30 17:09:03 +0000 |
commit | 42bb3f2194c23bffd60f7598d8055065e7c5754e (patch) | |
tree | a05c22b1025abde8503211bc522df99201eea241 /src/java | |
parent | 25f72b69786bac3838dffeaca94be3327cbe6652 (diff) | |
download | poi-42bb3f2194c23bffd60f7598d8055065e7c5754e.tar.gz poi-42bb3f2194c23bffd60f7598d8055065e7c5754e.zip |
Correct older biff detection, and add unit tests for HSSFWorkbook giving helpful exceptions on the older formats
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1642568 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/org/apache/poi/poifs/storage/HeaderBlock.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/java/org/apache/poi/poifs/storage/HeaderBlock.java b/src/java/org/apache/poi/poifs/storage/HeaderBlock.java index 560111fa01..06e9c4a1b9 100644 --- a/src/java/org/apache/poi/poifs/storage/HeaderBlock.java +++ b/src/java/org/apache/poi/poifs/storage/HeaderBlock.java @@ -136,7 +136,7 @@ public final class HeaderBlock implements HeaderBlockConstants { if (_data[0] == 0x09 && _data[1] == 0x00 && // sid=0x0009 _data[2] == 0x04 && _data[3] == 0x00 && // size=0x0004 _data[4] == 0x00 && _data[5] == 0x00 && // unused - (_data[6] == 0x01 || _data[6] == 0x02 || _data[6] == 0x04) && + (_data[6] == 0x10 || _data[6] == 0x20 || _data[6] == 0x40) && _data[7] == 0x00) { // BIFF2 raw stream throw new OldExcelFormatException("The supplied data appears to be in BIFF2 format. " + @@ -145,7 +145,7 @@ public final class HeaderBlock implements HeaderBlockConstants { if (_data[0] == 0x09 && _data[1] == 0x02 && // sid=0x0209 _data[2] == 0x06 && _data[3] == 0x00 && // size=0x0006 _data[4] == 0x00 && _data[5] == 0x00 && // unused - (_data[6] == 0x01 || _data[6] == 0x02 || _data[6] == 0x04) && + (_data[6] == 0x10 || _data[6] == 0x20 || _data[6] == 0x40) && _data[7] == 0x00) { // BIFF3 raw stream throw new OldExcelFormatException("The supplied data appears to be in BIFF3 format. " + @@ -154,7 +154,7 @@ public final class HeaderBlock implements HeaderBlockConstants { if (_data[0] == 0x09 && _data[1] == 0x04 && // sid=0x0409 _data[2] == 0x06 && _data[3] == 0x00 && // size=0x0006 _data[4] == 0x00 && _data[5] == 0x00) { // unused - if (((_data[6] == 0x01 || _data[6] == 0x02 || _data[6] == 0x04) && + if (((_data[6] == 0x10 || _data[6] == 0x20 || _data[6] == 0x40) && _data[7] == 0x00) || (_data[6] == 0x00 && _data[7] == 0x01)) { // BIFF4 raw stream |