You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2007/12/04 13:33:25 UTC
svn commit: r600910 -
/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
Author: nick
Date: Tue Dec 4 04:33:24 2007
New Revision: 600910
URL: http://svn.apache.org/viewvc?rev=600910&view=rev
Log:
Fix work bug #42799
Modified:
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java?rev=600910&r1=600909&r2=600910&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java Tue Dec 4 04:33:24 2007
@@ -19,6 +19,8 @@
package org.apache.poi.hwpf.model;
import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
import org.apache.poi.hwpf.model.io.*;
@@ -37,6 +39,7 @@
{
private static final int LIST_DATA_SIZE = 28;
private static final int LIST_FORMAT_OVERRIDE_SIZE = 16;
+ private static POILogger log = POILogFactory.getLogger(ListTables.class);
HashMap _listMap = new HashMap();
ArrayList _overrideList = new ArrayList();
@@ -189,8 +192,13 @@
public ListLevel getLevel(int listID, int level)
{
ListData lst = (ListData)_listMap.get(new Integer(listID));
- ListLevel lvl = lst.getLevels()[level];
- return lvl;
+ if(level < lst.numLevels()) {
+ ListLevel lvl = lst.getLevels()[level];
+ return lvl;
+ } else {
+ log.log(POILogger.WARN, "Requested level " + level + " which was greater than the maximum defined (" + lst.numLevels() + ")");
+ return null;
+ }
}
public ListData getListData(int listID)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org