another bugfix
authoradam <adam@megacz.com>
Mon, 11 Apr 2005 07:05:52 +0000 (07:05 +0000)
committeradam <adam@megacz.com>
Mon, 11 Apr 2005 07:05:52 +0000 (07:05 +0000)
darcs-hash:20050411070552-5007d-859792b673275c8203d6eb0b85a38ccbb185eb0c.gz

src/org/ibex/util/Basket.java
src/org/ibex/util/GetDep.java

index bd981b6..baee97c 100644 (file)
@@ -76,9 +76,11 @@ public interface Basket extends Serializable {
             o[i] = obj; size++;
         }
         public Object set(int i, Object obj) {
-            if (i >= size) throw new IndexOutOfBoundsException(
+            if (i >= o.length) throw new IndexOutOfBoundsException(
                 "index "+i+" is beyond list boundary "+size);
-            Object old = o[i]; o[i] = obj; return old;
+            Object old = o[i]; o[i] = obj;
+           size = Math.max(i+1, size);
+           return old;
         }
         public Object get(int i) {
             if (i >= size) throw new IndexOutOfBoundsException(
index 9e0e67a..135dd8b 100644 (file)
@@ -44,7 +44,7 @@ public final class GetDep {
                     if (ze == null) break;
                     if (ze.getName().equals(path)) return zis;
                 }
-                return null;
+                throw new RuntimeException("could not find file within archive");
             } else {
                 Tar.TarInputStream tis = new Tar.TarInputStream(new GZIPInputStream(rest));
                 while(true) {
@@ -52,7 +52,7 @@ public final class GetDep {
                     if (te == null) break;
                     if (te.getName().equals(path)) return tis;
                 }
-                return null;
+                throw new RuntimeException("could not find file within archive");
             }
         } else {
             URL u = new URL(url);