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
This commit is contained in:
Dominik Stadler 2016-06-30 21:06:04 +00:00
parent e1f7c9ae23
commit 6b1caa4e2c
3 changed files with 19 additions and 3 deletions

View File

@ -161,7 +161,18 @@ public final class FileInformationBlock implements Cloneable
assertCbRgFcLcb( "0x0112", 0x00B7, "0x00B7", _cbRgFcLcb ); assertCbRgFcLcb( "0x0112", 0x00B7, "0x00B7", _cbRgFcLcb );
break; break;
default: 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 ); assertCswNew( "0x0112", 0x0005, "0x0005", _cswNew );
break; break;
default: 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 ) catch ( Exception exc )
{ {
stringBuilder.append( "(exc: " + exc.getMessage() + ")" ); stringBuilder.append("(exc: ").append(exc.getMessage()).append(")");
} }
stringBuilder.append( "[/FIB2]\n" ); stringBuilder.append( "[/FIB2]\n" );
return stringBuilder.toString(); return stringBuilder.toString();

View 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);
}
} }