Improve error message, and fix generics warnings

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@904049 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2010-01-28 12:00:38 +00:00
parent 81755dc8d2
commit 2880d934f9
2 changed files with 4 additions and 3 deletions

View File

@ -67,7 +67,7 @@ public class StringUtil {
final int len) final int len)
throws ArrayIndexOutOfBoundsException, IllegalArgumentException { throws ArrayIndexOutOfBoundsException, IllegalArgumentException {
if ((offset < 0) || (offset >= string.length)) { if ((offset < 0) || (offset >= string.length)) {
throw new ArrayIndexOutOfBoundsException("Illegal offset"); throw new ArrayIndexOutOfBoundsException("Illegal offset " + offset + " (String data is of length " + string.length + ")");
} }
if ((len < 0) || (((string.length - offset) / 2) < len)) { if ((len < 0) || (((string.length - offset) / 2) < len)) {
throw new IllegalArgumentException("Illegal length " + len); throw new IllegalArgumentException("Illegal length " + len);

View File

@ -41,7 +41,8 @@ public final class ChunkFactory {
/** /**
* Key is a Chunk's type, value is an array of its CommandDefinitions * Key is a Chunk's type, value is an array of its CommandDefinitions
*/ */
private Hashtable chunkCommandDefinitions = new Hashtable(); private Hashtable<Integer, CommandDefinition[]> chunkCommandDefinitions =
new Hashtable<Integer, CommandDefinition[]>();
/** /**
* What the name is of the chunk table definitions file? * What the name is of the chunk table definitions file?
* This file comes from the scratchpad resources directory. * This file comes from the scratchpad resources directory.
@ -81,7 +82,7 @@ public final class ChunkFactory {
throw new IllegalStateException("Expecting start xxx, found " + line); throw new IllegalStateException("Expecting start xxx, found " + line);
} }
int chunkType = Integer.parseInt(line.substring(6)); int chunkType = Integer.parseInt(line.substring(6));
ArrayList defsL = new ArrayList(); ArrayList<CommandDefinition> defsL = new ArrayList<CommandDefinition>();
// Data entries // Data entries
while( ! (line = inp.readLine()).startsWith("end") ) { while( ! (line = inp.readLine()).startsWith("end") ) {