Author: nick Date: Thu Aug 10 05:20:24 2006 New Revision: 430365 URL: http://svn.apache.org/viewvc?rev=430365&view=rev Log: Throw a more useful exception in the case of word95 documents
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java?rev=430365&r1=430364&r2=430365&view=diff ============================================================================== --- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java (original) +++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java Thu Aug 10 05:20:24 2006 @@ -19,6 +19,7 @@ import java.io.InputStream; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.PushbackInputStream; import java.io.IOException; import java.io.OutputStream; @@ -153,9 +154,16 @@ name = "1Table"; } + // Grab the table stream. + DocumentEntry tableProps; + try { + tableProps = + (DocumentEntry)filesystem.getRoot().getEntry(name); + } catch(FileNotFoundException fnfe) { + throw new IllegalStateException("Table Stream '" + name + "' wasn't found - Either the document is corrupt, or is Word95 (or earlier)"); + } + // read in the table stream. - DocumentEntry tableProps = - (DocumentEntry)filesystem.getRoot().getEntry(name); _tableStream = new byte[tableProps.getSize()]; filesystem.createDocumentInputStream(name).read(_tableStream); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta POI Project: http://jakarta.apache.org/poi/