From: Dominik Stadler Date: Thu, 30 Jun 2016 21:06:04 +0000 (+0000) Subject: Bug 59739: For now fix the regression in FileInformationBlock which was introduced... X-Git-Tag: REL_3_15_BETA3~248 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e616b8cf12eed3ae3da7ac0a18c6674e13f8e4a5;p=poi.git Bug 59739: For now fix the regression in FileInformationBlock which was introduced after 3.15-beta1 so that the documents can be loaded again pending a full fix as discussed in the bug. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1750864 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java index 03199b330e..01b090830c 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java @@ -161,7 +161,18 @@ public final class FileInformationBlock implements Cloneable assertCbRgFcLcb( "0x0112", 0x00B7, "0x00B7", _cbRgFcLcb ); break; default: - throw new IllegalStateException("Invalid file format version number: " + getNFib()); + /* +When running with the large CommonCrawl corpus we found the following ids in documents that are processed fine: +java.lang.IllegalStateException: Invalid file format version number: 113 +java.lang.IllegalStateException: Invalid file format version number: 191 +java.lang.IllegalStateException: Invalid file format version number: 192 +java.lang.IllegalStateException: Invalid file format version number: 194 +java.lang.IllegalStateException: Invalid file format version number: 195 +java.lang.IllegalStateException: Invalid file format version number: 216 +java.lang.IllegalStateException: Invalid file format version number: 265 +java.lang.IllegalStateException: Invalid file format version number: 267 + */ + logger.log(POILogger.WARN, "Invalid file format version number: " + getNFib()); } } @@ -197,7 +208,7 @@ public final class FileInformationBlock implements Cloneable assertCswNew( "0x0112", 0x0005, "0x0005", _cswNew ); break; default: - throw new IllegalStateException("Invalid file format version number: " + getNFib()); + logger.log(POILogger.WARN, "Invalid file format version number: " + getNFib()); } } @@ -321,7 +332,7 @@ public final class FileInformationBlock implements Cloneable } catch ( Exception exc ) { - stringBuilder.append( "(exc: " + exc.getMessage() + ")" ); + stringBuilder.append("(exc: ").append(exc.getMessage()).append(")"); } stringBuilder.append( "[/FIB2]\n" ); return stringBuilder.toString(); diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java index 25c21cd6e2..c63361d064 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java @@ -894,4 +894,9 @@ public class TestBugs extends TestCase } } } + + public void testRegressionIn315beta2() { + HWPFDocument hwpfDocument = HWPFTestDataSamples.openSampleFile("cap.stanford.edu_profiles_viewbiosketch_facultyid=4009&name=m_maciver.doc"); + assertNotNull(hwpfDocument); + } } diff --git a/test-data/document/cap.stanford.edu_profiles_viewbiosketch_facultyid=4009&name=m_maciver.doc b/test-data/document/cap.stanford.edu_profiles_viewbiosketch_facultyid=4009&name=m_maciver.doc new file mode 100644 index 0000000000..643d8224ae Binary files /dev/null and b/test-data/document/cap.stanford.edu_profiles_viewbiosketch_facultyid=4009&name=m_maciver.doc differ