aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/util
diff options
context:
space:
mode:
authorMark Wielaard <mark@gcc.gnu.org>2002-11-03 20:27:31 +0000
committerMark Wielaard <mark@gcc.gnu.org>2002-11-03 20:27:31 +0000
commitde36f65dd133d189aa889f70bf380499596a310c (patch)
tree30c789f77765f6a4f5d115a1720bdb304829cfd7 /libjava/java/util
parentc33c471beba9625b037428df4d4da0ecd5cbba4d (diff)
downloadgcc-de36f65dd133d189aa889f70bf380499596a310c.zip
gcc-de36f65dd133d189aa889f70bf380499596a310c.tar.gz
gcc-de36f65dd133d189aa889f70bf380499596a310c.tar.bz2
GNU Classpath merge.
2002-10-31 Stephen Crawley <crawley@dstc.edu.au> * java/lang/Double.java (valueOf): Return new Double(parseDouble(s)). 2002-10-31 Wu Gansha <gansha.wu@intel.com>: * java/util/ArrayList.java (readObject, writeObject): Only read/write size items. 2002-10-31 Wu Gansha <gansha.wu@intel.com>: * java/io/DataInputStream.java (convertFromUTF): Give StringBuffer an initial estimated size to avoid enlarge buffer frequently. 2002-10-31 Wu Gansha <gansha.wu@intel.com>: * java/lang/reflect/Proxy.java (ProxyType): Set loader to System ClassLoader when null. (ProxyType.hashCode): Loader null check no longer needed. (ProxyType.sameTypes): New method. (ProxyType.equals): Use new method. 2002-10-31 Mark Wielaard <mark@klomp.org> * java/net/URLDecoder.java (decode): Initialize Stringbuffer size to length of String. * java/net/URLEncoder.java (encode): Likewise. 2002-10-31 Mark Wielaard <mark@klomp.org> * java/util/zip/ZipInputStream.java (getNextEntry): Throw IOException when stream is closed. (closeEntry): Likewise. (read): Likewise. * java/util/zip/ZipOutputStream.java (putNextEntry): Throw ZipException when no entry active. (closeEntry): Likewise. (write): Likewise. From-SVN: r58772
Diffstat (limited to 'libjava/java/util')
-rw-r--r--libjava/java/util/ArrayList.java6
-rw-r--r--libjava/java/util/zip/ZipInputStream.java6
-rw-r--r--libjava/java/util/zip/ZipOutputStream.java12
3 files changed, 13 insertions, 11 deletions
diff --git a/libjava/java/util/ArrayList.java b/libjava/java/util/ArrayList.java
index 2d2146d..c6f6b86 100644
--- a/libjava/java/util/ArrayList.java
+++ b/libjava/java/util/ArrayList.java
@@ -558,7 +558,9 @@ public class ArrayList extends AbstractList
// We serialize unused list entries to preserve capacity.
int len = data.length;
s.writeInt(len);
- for (int i = 0; i < len; i++)
+ // it would be more efficient to just write "size" items,
+ // this need readObject read "size" items too.
+ for (int i = 0; i < size; i++)
s.writeObject(data[i]);
}
@@ -578,7 +580,7 @@ public class ArrayList extends AbstractList
s.defaultReadObject();
int capacity = s.readInt();
data = new Object[capacity];
- for (int i = 0; i < capacity; i++)
+ for (int i = 0; i < size; i++)
data[i] = s.readObject();
}
}
diff --git a/libjava/java/util/zip/ZipInputStream.java b/libjava/java/util/zip/ZipInputStream.java
index 710ca74..c9a6c01 100644
--- a/libjava/java/util/zip/ZipInputStream.java
+++ b/libjava/java/util/zip/ZipInputStream.java
@@ -139,7 +139,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
public ZipEntry getNextEntry() throws IOException
{
if (crc == null)
- throw new IllegalStateException("Closed.");
+ throw new IOException("Stream closed.");
if (entry != null)
closeEntry();
@@ -216,7 +216,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
public void closeEntry() throws IOException
{
if (crc == null)
- throw new IllegalStateException("Closed.");
+ throw new IOException("Stream closed.");
if (entry == null)
return;
@@ -287,7 +287,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
public int read(byte[] b, int off, int len) throws IOException
{
if (crc == null)
- throw new IllegalStateException("Closed.");
+ throw new IOException("Stream closed.");
if (entry == null)
return -1;
boolean finished = false;
diff --git a/libjava/java/util/zip/ZipOutputStream.java b/libjava/java/util/zip/ZipOutputStream.java
index e4fb864a..44c4a9c 100644
--- a/libjava/java/util/zip/ZipOutputStream.java
+++ b/libjava/java/util/zip/ZipOutputStream.java
@@ -158,12 +158,12 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
* is not set in the entry, the current time is used.
* @param entry the entry.
* @exception IOException if an I/O error occured.
- * @exception IllegalStateException if stream was finished
+ * @exception ZipException if stream was finished.
*/
public void putNextEntry(ZipEntry entry) throws IOException
{
if (entries == null)
- throw new IllegalStateException("ZipOutputStream was finished");
+ throw new ZipException("ZipOutputStream was finished");
int method = entry.getMethod();
int flags = 0;
@@ -249,12 +249,12 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
/**
* Closes the current entry.
* @exception IOException if an I/O error occured.
- * @exception IllegalStateException if no entry is active.
+ * @exception ZipException if no entry is active.
*/
public void closeEntry() throws IOException
{
if (curEntry == null)
- throw new IllegalStateException("No open entry");
+ throw new ZipException("No open entry");
/* First finish the deflater, if appropriate */
if (curMethod == DEFLATED)
@@ -300,12 +300,12 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
/**
* Writes the given buffer to the current entry.
* @exception IOException if an I/O error occured.
- * @exception IllegalStateException if no entry is active.
+ * @exception ZipException if no entry is active.
*/
public void write(byte[] b, int off, int len) throws IOException
{
if (curEntry == null)
- throw new IllegalStateException("No open entry.");
+ throw new ZipException("No open entry.");
switch (curMethod)
{