poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Wooster <pkwoos...@gmail.com>
Subject Unable to get paragraphs from test.doc
Date Tue, 02 Aug 2005 17:32:14 GMT
I was trying to run some coverage tests against HWPF and found that I
can't get the first paragraph of the file
scratchpad/testcases/org/apache/poi/hwpf/data/test.doc.   Resaving the
.doc using word2003 fixes the problem.  This error also occurs if I
try to use the Word2Forrest example on that file.

The relevant portion of the stack trace is:
     [java] java.lang.ArrayIndexOutOfBoundsException: 6
     [java]     at
org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:491)
     [java]     at
org.apache.poi.util.LittleEndian.getShort(LittleEndian.java:52)
     [java]     at
org.apache.poi.hwpf.sprm.SprmOperation.<init>(SprmOperation.java:54)
     [java]     at
org.apache.poi.hwpf.sprm.SprmIterator.next(SprmIterator.java:46)
     [java]     at
org.apache.poi.hwpf.sprm.ParagraphSprmUncompressor.uncompressPAP(ParagraphSprmUncompressor.java:59)
     [java]     at
org.apache.poi.hwpf.model.PAPX.getParagraphProperties(PAPX.java:129)
     [java]     at
org.apache.poi.hwpf.usermodel.Range.getParagraph(Range.java:654)
     [java]     at Test.main(Test.java:11)

The simplified version of the test is:

import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.*;
import org.apache.poi.hwpf.model.*;
import java.io.*;

public class Test
{
  public static void main(String[] args) {
    try {
      HWPFDocument doc = new HWPFDocument(new FileInputStream(args[0]));
      doc.getRange().getParagraph (0);
    }
    catch (Exception e) {
        e.printStackTrace();
    }
  }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/


Mime
View raw message