Bug 39595 - java.lang.IndexOutOfBoundsException: Index: 7, Size: 7
Summary: java.lang.IndexOutOfBoundsException: Index: 7, Size: 7
Status: RESOLVED LATER
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.0-dev
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-16 22:43 UTC by Xianing Zhu
Modified: 2011-02-25 17:02 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xianing Zhu 2006-05-16 22:43:08 UTC
InputStream data = .....
HWPFDocument doc = new HWPFDocument(data)
StyleSheet styleSheet = doc.getStyleSheet();
Range r = doc.getRange();
int lenParagraph = r.numParagraphs();

Range.numParagraphs() throw: java.lang.IndexOutOfBoundsException: Index: 7, 
Size: 7

The problem was cased in CHPBinTable and PAPBinTable method: adjustForDelete
(..)
      chpx = (CHPX)_textRuns.get(endIndex);
      chpx.setEnd((chpx.getEnd() - endMark) + offset);
 The start did not be ajusted. When start is less than offset, it causes 
java.lang.IndexOutOfBoundsException.
Comment 1 Nick Burch 2011-02-25 17:02:14 UTC
I believe this has been solved by HWPF updates in the intervening time. Please re-open if the bug still remains for you with a recent svn nightly build / poi 3.8 beta 1 (when released)