Bug 42799 - Array out of bound exception in ListTables public ListLevel getLevel(int listID, int level)
Summary: Array out of bound exception in ListTables public ListLevel getLevel(int list...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.0-dev
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-03 02:06 UTC by Robert Pastor
Modified: 2007-12-04 04:33 UTC (History)
0 users



Attachments
This "corrupted" WORD 2000 file leads to an "array out of bound" exception (323.50 KB, application/msword)
2007-07-04 01:57 UTC, Robert Pastor
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Pastor 2007-07-03 02:06:46 UTC
package org.apache.poi.hwpf.model;
public class ListTables
When the "level" index is greater to the lst.numLevels() we got an array out of 
bound exception:
Proposed change is :
public ListLevel getLevel(int listID, int level)
  {
    ListData lst = (ListData)_listMap.get(new Integer(listID));
    if (level < lst.numLevels()) {
    	ListLevel lvl = lst.getLevels()[level];
    	return lvl;
    }
    else {
    	return null;
    }
  }
Comment 1 Nick Burch 2007-07-03 06:52:11 UTC
Do you have a sample file that shows up this problem, that you could attach to
the bug?
Comment 2 Robert Pastor 2007-07-04 01:57:15 UTC
Created attachment 20445 [details]
This "corrupted" WORD 2000 file leads to an "array out of bound" exception

Trying to sort out where the problem would be in the MS WORD input file, I
discovered that the WORD document was stated as "corrupted" by MS WORD when
opening it.
I understand that the proposed solution does not correct the root cause of the
problem, but only tries to avoid an exception which does not retrieve the kind
of data I wanted to extract from the MS WORD file.
Comment 3 Nick Burch 2007-12-04 04:33:25 UTC
Proposed patch applied