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
This commit is contained in:
parent
4aef973c2e
commit
f70b7142c2
10 changed files with 50 additions and 57 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue