Commit 5237cd77 by Michael Koch Committed by Michael Koch

Font.java, [...]: Removed some redundant obj == null checks.

2003-11-11  Michael Koch  <konqueror@gmx.de>

	* java/awt/Font.java,
	java/awt/datatransfer/DataFlavor.java,
	java/math/BigInteger.java,
	java/net/Inet4Address.java,
	java/net/Inet6Address.java,
	java/rmi/MarshalledObject.java,
	java/rmi/server/RMIClassLoader.java,
	java/security/cert/CertStore.java,
	java/sql/Timestamp.java,
	java/text/SimpleDateFormat.java,
	javax/naming/CompoundName.java:
	Removed some redundant obj == null checks.

From-SVN: r73448
parent c824ce21
2003-11-11 Michael Koch <konqueror@gmx.de> 2003-11-11 Michael Koch <konqueror@gmx.de>
* java/awt/Font.java,
java/awt/datatransfer/DataFlavor.java,
java/math/BigInteger.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/rmi/MarshalledObject.java,
java/rmi/server/RMIClassLoader.java,
java/security/cert/CertStore.java,
java/sql/Timestamp.java,
java/text/SimpleDateFormat.java,
javax/naming/CompoundName.java:
Removed some redundant obj == null checks.
2003-11-11 Michael Koch <konqueror@gmx.de>
* java/nio/ByteBuffer.java * java/nio/ByteBuffer.java
(equals): Remove redundant obj == null check. (equals): Remove redundant obj == null check.
......
...@@ -1226,9 +1226,6 @@ hashCode() ...@@ -1226,9 +1226,6 @@ hashCode()
public boolean public boolean
equals(Object obj) equals(Object obj)
{ {
if (obj == null)
return(false);
if (!(obj instanceof Font)) if (!(obj instanceof Font))
return(false); return(false);
......
...@@ -723,9 +723,6 @@ equals(DataFlavor flavor) ...@@ -723,9 +723,6 @@ equals(DataFlavor flavor)
public boolean public boolean
equals(Object obj) equals(Object obj)
{ {
if (obj == null)
return(false);
if (!(obj instanceof DataFlavor)) if (!(obj instanceof DataFlavor))
return(false); return(false);
......
...@@ -1565,7 +1565,7 @@ public class BigInteger extends Number implements Comparable ...@@ -1565,7 +1565,7 @@ public class BigInteger extends Number implements Comparable
/* Assumes this and obj are both canonicalized. */ /* Assumes this and obj are both canonicalized. */
public boolean equals(Object obj) public boolean equals(Object obj)
{ {
if (obj == null || ! (obj instanceof BigInteger)) if (! (obj instanceof BigInteger))
return false; return false;
return equals(this, (BigInteger) obj); return equals(this, (BigInteger) obj);
} }
......
...@@ -258,7 +258,7 @@ public final class Inet4Address extends InetAddress ...@@ -258,7 +258,7 @@ public final class Inet4Address extends InetAddress
*/ */
public boolean equals (Object obj) public boolean equals (Object obj)
{ {
if (obj == null || ! (obj instanceof InetAddress)) if (! (obj instanceof InetAddress))
return false; return false;
byte[] addr1 = addr; byte[] addr1 = addr;
......
...@@ -243,7 +243,7 @@ public final class Inet6Address extends InetAddress ...@@ -243,7 +243,7 @@ public final class Inet6Address extends InetAddress
*/ */
public boolean equals (Object obj) public boolean equals (Object obj)
{ {
if (obj == null || ! (obj instanceof Inet6Address)) if (! (obj instanceof Inet6Address))
return false; return false;
Inet6Address tmp = (Inet6Address) obj; Inet6Address tmp = (Inet6Address) obj;
......
...@@ -76,7 +76,7 @@ public final class MarshalledObject ...@@ -76,7 +76,7 @@ public final class MarshalledObject
public boolean equals(Object obj) public boolean equals(Object obj)
{ {
if(obj == null || !(obj instanceof MarshalledObject) ) if (! (obj instanceof MarshalledObject))
return false; return false;
// hashCode even differs, don't do the time-consuming comparisons // hashCode even differs, don't do the time-consuming comparisons
......
...@@ -113,8 +113,7 @@ public class RMIClassLoader ...@@ -113,8 +113,7 @@ public class RMIClassLoader
*/ */
public boolean equals (Object theOther) public boolean equals (Object theOther)
{ {
if (theOther != null if (theOther instanceof CacheKey)
&& theOther instanceof CacheKey)
{ {
CacheKey key = (CacheKey) theOther; CacheKey key = (CacheKey) theOther;
......
...@@ -215,8 +215,7 @@ public class CertStore ...@@ -215,8 +215,7 @@ public class CertStore
catch (java.lang.reflect.InvocationTargetException ite) catch (java.lang.reflect.InvocationTargetException ite)
{ {
Throwable cause = ite.getCause(); Throwable cause = ite.getCause();
if (cause != null && if (cause instanceof InvalidAlgorithmParameterException)
(cause instanceof InvalidAlgorithmParameterException))
throw (InvalidAlgorithmParameterException) cause; throw (InvalidAlgorithmParameterException) cause;
else else
throw new NoSuchAlgorithmException(type); throw new NoSuchAlgorithmException(type);
......
...@@ -224,9 +224,6 @@ public class Timestamp extends java.util.Date ...@@ -224,9 +224,6 @@ public class Timestamp extends java.util.Date
*/ */
public boolean equals(Object obj) public boolean equals(Object obj)
{ {
if (obj == null)
return false;
if (!(obj instanceof Timestamp)) if (!(obj instanceof Timestamp))
return false; return false;
......
...@@ -374,9 +374,6 @@ public class SimpleDateFormat extends DateFormat ...@@ -374,9 +374,6 @@ public class SimpleDateFormat extends DateFormat
*/ */
public boolean equals(Object o) public boolean equals(Object o)
{ {
if (o == null)
return false;
if (!super.equals(o)) if (!super.equals(o))
return false; return false;
......
...@@ -240,7 +240,7 @@ public class CompoundName implements Name, Cloneable, Serializable ...@@ -240,7 +240,7 @@ public class CompoundName implements Name, Cloneable, Serializable
public int compareTo (Object obj) public int compareTo (Object obj)
{ {
if (obj == null || ! (obj instanceof CompoundName)) if (! (obj instanceof CompoundName))
throw new ClassCastException ("CompoundName.compareTo() expected CompoundName"); throw new ClassCastException ("CompoundName.compareTo() expected CompoundName");
CompoundName cn = (CompoundName) obj; CompoundName cn = (CompoundName) obj;
int last = Math.min (cn.elts.size (), elts.size ()); int last = Math.min (cn.elts.size (), elts.size ());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment