]> source.dussan.org Git - poi.git/commitdiff
Improve error message, and fix generics warnings
authorNick Burch <nick@apache.org>
Thu, 28 Jan 2010 12:00:38 +0000 (12:00 +0000)
committerNick Burch <nick@apache.org>
Thu, 28 Jan 2010 12:00:38 +0000 (12:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@904049 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/util/StringUtil.java
src/scratchpad/src/org/apache/poi/hdgf/chunks/ChunkFactory.java

index 62e42c2a2f1369d442fdd2512a58a2de43d9a43d..81568fe9c0d9583eb8c791e088ab758a42c5c5b5 100644 (file)
@@ -67,7 +67,7 @@ public class StringUtil {
                final int len)
                throws ArrayIndexOutOfBoundsException, IllegalArgumentException {
                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)) {
                        throw new IllegalArgumentException("Illegal length " + len);
index 3bc35883d68ca3ddf1efe4a967bab49f94bc9473..55cb5a7f18eed8d8996924376cba338ab8ea74ce 100644 (file)
@@ -41,7 +41,8 @@ public final class ChunkFactory {
        /**
         * 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?
         * This file comes from the scratchpad resources directory.
@@ -81,7 +82,7 @@ public final class ChunkFactory {
                                throw new IllegalStateException("Expecting start xxx, found " + line);
                        }
                        int chunkType = Integer.parseInt(line.substring(6));
-                       ArrayList defsL = new ArrayList();
+                       ArrayList<CommandDefinition> defsL = new ArrayList<CommandDefinition>();
 
                        // Data entries
                        while( ! (line = inp.readLine()).startsWith("end") ) {