HDFS-15913. Remove useless NULL checks before instanceof (#2805)
This commit is contained in:
parent
d8ec8ab965
commit
9c2a712597
|
@ -219,7 +219,7 @@ public class BlockStoragePolicy implements BlockStoragePolicySpi {
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
} else if (obj == null || !(obj instanceof BlockStoragePolicy)) {
|
} else if (!(obj instanceof BlockStoragePolicy)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final BlockStoragePolicy that = (BlockStoragePolicy)obj;
|
final BlockStoragePolicy that = (BlockStoragePolicy)obj;
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class RollingUpgradeInfo extends RollingUpgradeStatus {
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
} else if (obj == null || !(obj instanceof RollingUpgradeInfo)) {
|
} else if (!(obj instanceof RollingUpgradeInfo)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final RollingUpgradeInfo that = (RollingUpgradeInfo)obj;
|
final RollingUpgradeInfo that = (RollingUpgradeInfo)obj;
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class RollingUpgradeStatus {
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
} else if (obj == null || !(obj instanceof RollingUpgradeStatus)) {
|
} else if (!(obj instanceof RollingUpgradeStatus)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final RollingUpgradeStatus that = (RollingUpgradeStatus) obj;
|
final RollingUpgradeStatus that = (RollingUpgradeStatus) obj;
|
||||||
|
|
|
@ -622,7 +622,7 @@ public class Dispatcher {
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
} else if (obj == null || !(obj instanceof StorageGroup)) {
|
} else if (!(obj instanceof StorageGroup)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
final StorageGroup that = (StorageGroup) obj;
|
final StorageGroup that = (StorageGroup) obj;
|
||||||
|
|
|
@ -321,7 +321,7 @@ public class DatanodeStorageInfo {
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
} else if (obj == null || !(obj instanceof DatanodeStorageInfo)) {
|
} else if (!(obj instanceof DatanodeStorageInfo)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final DatanodeStorageInfo that = (DatanodeStorageInfo)obj;
|
final DatanodeStorageInfo that = (DatanodeStorageInfo)obj;
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class ErrorReportAction implements BPServiceActorAction {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj == null || !(obj instanceof ErrorReportAction)) {
|
if (!(obj instanceof ErrorReportAction)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ErrorReportAction other = (ErrorReportAction) obj;
|
ErrorReportAction other = (ErrorReportAction) obj;
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class ReportBadBlockAction implements BPServiceActorAction {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (obj == null || !(obj instanceof ReportBadBlockAction)) {
|
if (!(obj instanceof ReportBadBlockAction)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ReportBadBlockAction other = (ReportBadBlockAction) obj;
|
ReportBadBlockAction other = (ReportBadBlockAction) obj;
|
||||||
|
|
|
@ -200,7 +200,7 @@ public class StorageLocation
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null || !(obj instanceof StorageLocation)) {
|
if (!(obj instanceof StorageLocation)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int comp = compareTo((StorageLocation) obj);
|
int comp = compareTo((StorageLocation) obj);
|
||||||
|
|
|
@ -850,7 +850,7 @@ public abstract class INode implements INodeAttributes, Diff.Element<byte[]> {
|
||||||
if (this == that) {
|
if (this == that) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (that == null || !(that instanceof INode)) {
|
if (!(that instanceof INode)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return getId() == ((INode) that).getId();
|
return getId() == ((INode) that).getId();
|
||||||
|
|
|
@ -275,7 +275,7 @@ public class QuotaCounts {
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
} else if (obj == null || !(obj instanceof QuotaCounts)) {
|
} else if (!(obj instanceof QuotaCounts)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final QuotaCounts that = (QuotaCounts)obj;
|
final QuotaCounts that = (QuotaCounts)obj;
|
||||||
|
|
|
@ -232,7 +232,7 @@ public class Snapshot implements Comparable<byte[]> {
|
||||||
public boolean equals(Object that) {
|
public boolean equals(Object that) {
|
||||||
if (this == that) {
|
if (this == that) {
|
||||||
return true;
|
return true;
|
||||||
} else if (that == null || !(that instanceof Snapshot)) {
|
} else if (!(that instanceof Snapshot)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return this.id == ((Snapshot)that).id;
|
return this.id == ((Snapshot)that).id;
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class EnumCounters<E extends Enum<E>> {
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
} else if (obj == null || !(obj instanceof EnumCounters)) {
|
} else if (!(obj instanceof EnumCounters)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final EnumCounters<?> that = (EnumCounters<?>)obj;
|
final EnumCounters<?> that = (EnumCounters<?>)obj;
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class EnumDoubles<E extends Enum<E>> {
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
} else if (obj == null || !(obj instanceof EnumDoubles)) {
|
} else if (!(obj instanceof EnumDoubles)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final EnumDoubles<?> that = (EnumDoubles<?>)obj;
|
final EnumDoubles<?> that = (EnumDoubles<?>)obj;
|
||||||
|
|
Loading…
Reference in New Issue