]> source.dussan.org Git - poi.git/commitdiff
Bug 59739: For now fix the regression in FileInformationBlock which was introduced...
authorDominik Stadler <centic@apache.org>
Thu, 30 Jun 2016 21:06:04 +0000 (21:06 +0000)
committerDominik Stadler <centic@apache.org>
Thu, 30 Jun 2016 21:06:04 +0000 (21:06 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1750864 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java
src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
test-data/document/cap.stanford.edu_profiles_viewbiosketch_facultyid=4009&name=m_maciver.doc [new file with mode: 0644]

index 03199b330e70845b2c917369a534ea4f1161d125..01b090830c9b2283c250ec0d8c15b46ba017a2eb 100644 (file)
@@ -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();
index 25c21cd6e234aa70460d3e5dec0483f339e57a71..c63361d0641a1ecd375cc3e8a761273c85dd55e1 100644 (file)
@@ -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 (file)
index 0000000..643d822
Binary files /dev/null and b/test-data/document/cap.stanford.edu_profiles_viewbiosketch_facultyid=4009&name=m_maciver.doc differ