diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-05-04 15:50:34 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-05-04 15:50:34 +0000 |
commit | f70b7142c2a972ac6071b22ab4cfec672d358240 (patch) | |
tree | f8a39214ab1068b5c5daff2e7c514fdafb29c17d /libjava/java/util | |
parent | 4aef973c2eae349b95773374d2f8afd0dded3e56 (diff) | |
download | gcc-f70b7142c2a972ac6071b22ab4cfec672d358240.zip gcc-f70b7142c2a972ac6071b22ab4cfec672d358240.tar.gz gcc-f70b7142c2a972ac6071b22ab4cfec672d358240.tar.bz2 |
Locale.java (Locale): Don't explicitly check for null.
* java/util/Locale.java (Locale): Don't explicitly check for
null.
* java/util/Hashtable.java (containsKey): Don't explicitly check
for null.
(get): Likewise.
* java/util/BitSet.java (and, or, xor): Don't explicitly check for
null.
* java/util/zip/ZipEntry.java (ZipEntry): Don't explicitly check
for null.
* java/text/StringCharacterIterator.java
(StringCharacterIterator): Don't check for null.
* java/text/ChoiceFormat.java (setChoices): Don't explicitly check
for null pointer.
* java/net/MulticastSocket.java (joinGroup): Don't explicitly
check for null pointer.
(leaveGroup): Likewise.
* java/net/DatagramPacket.java (DatagramPacket): Removed erroneous
comment.
(setData): Likewise.
* java/lang/ThreadGroup.java (ThreadGroup): Don't explicitly check
for `p==null'.
From-SVN: r33671
Diffstat (limited to 'libjava/java/util')
-rw-r--r-- | libjava/java/util/BitSet.java | 8 | ||||
-rw-r--r-- | libjava/java/util/Hashtable.java | 16 | ||||
-rw-r--r-- | libjava/java/util/Locale.java | 6 | ||||
-rw-r--r-- | libjava/java/util/zip/ZipEntry.java | 4 |
4 files changed, 8 insertions, 26 deletions
diff --git a/libjava/java/util/BitSet.java b/libjava/java/util/BitSet.java index 1a9e51b..56d89b1 100644 --- a/libjava/java/util/BitSet.java +++ b/libjava/java/util/BitSet.java @@ -1,6 +1,6 @@ // BitSet - A vector of bits. -/* Copyright (C) 1998, 1999 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000 Free Software Foundation This file is part of libgcj. @@ -24,8 +24,6 @@ public final class BitSet implements Cloneable, Serializable { public void and (BitSet bs) { - if (bs == null) - throw new NullPointerException (); int max = Math.min(bits.length, bs.bits.length); int i; for (i = 0; i < max; ++i) @@ -110,8 +108,6 @@ public final class BitSet implements Cloneable, Serializable public void or (BitSet bs) { - if (bs == null) - throw new NullPointerException (); ensure (bs.bits.length - 1); int i; for (i = 0; i < bs.bits.length; ++i) @@ -159,8 +155,6 @@ public final class BitSet implements Cloneable, Serializable public void xor (BitSet bs) { - if (bs == null) - throw new NullPointerException (); ensure (bs.bits.length - 1); int i; for (i = 0; i < bs.bits.length; ++i) diff --git a/libjava/java/util/Hashtable.java b/libjava/java/util/Hashtable.java index 62866b0..5b53611 100644 --- a/libjava/java/util/Hashtable.java +++ b/libjava/java/util/Hashtable.java @@ -164,7 +164,8 @@ public class Hashtable extends Dictionary implements Cloneable, Serializable return newTable; } - public synchronized boolean contains(Object value) throws NullPointerException + public synchronized boolean contains(Object value) + throws NullPointerException { // An exception is thrown here according to the JDK 1.2 doc. if (value == null) @@ -180,10 +181,6 @@ public class Hashtable extends Dictionary implements Cloneable, Serializable public synchronized boolean containsKey(Object key) { - // The Map interface mandates that we throw this. - if (key == null) - throw new NullPointerException (); - for (HashtableEntry elem = bucket[Math.abs(key.hashCode() % bucket.length)]; elem != null; elem = elem.nextEntry) @@ -200,11 +197,6 @@ public class Hashtable extends Dictionary implements Cloneable, Serializable public synchronized Object get(Object key) { - // The Dictionary interface mandates that get() throw a - // NullPointerException if key is null. - if (key == null) - throw new NullPointerException (); - for (HashtableEntry elem = bucket[Math.abs (key.hashCode() % bucket.length)]; elem != null; elem = elem.nextEntry) @@ -225,8 +217,10 @@ public class Hashtable extends Dictionary implements Cloneable, Serializable } public synchronized Object put(Object key, Object value) - throws NullPointerException + throws NullPointerException { + // We could really just check `value == null', but checking both + // is a bit clearer. if (key == null || value == null) throw new NullPointerException(); diff --git a/libjava/java/util/Locale.java b/libjava/java/util/Locale.java index e427e2e..d2dc2f7 100644 --- a/libjava/java/util/Locale.java +++ b/libjava/java/util/Locale.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000 Free Software Foundation This file is part of libgcj. @@ -65,10 +65,6 @@ public final class Locale implements java.io.Serializable, Cloneable public Locale (String languageCode, String countryCode, String variantCode) { - // We must explicitly check the arguments. - if (languageCode == null || countryCode == null - || variantCode == null) - throw new NullPointerException (); language = languageCode.toLowerCase(); country = countryCode.toUpperCase(); variant = variantCode.toUpperCase(); diff --git a/libjava/java/util/zip/ZipEntry.java b/libjava/java/util/zip/ZipEntry.java index 39df164..9ff7f4d 100644 --- a/libjava/java/util/zip/ZipEntry.java +++ b/libjava/java/util/zip/ZipEntry.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Free Software Foundation +/* Copyright (C) 1999, 2000 Free Software Foundation This file is part of libgcj. @@ -39,8 +39,6 @@ public class ZipEntry implements ZipConstants public ZipEntry (String name) { - if (name == null) - throw new NullPointerException (); if (name.length() > 65535) throw new IllegalArgumentException (); this.name = name; |