Fixing squid:S2259 - Null pointers should not be dereferenced
This commit is contained in:
parent
b3e260b234
commit
2d8e9d66e2
|
@ -76,7 +76,7 @@ public class EntityUniqueKey implements Serializable {
|
|||
@Override
|
||||
public boolean equals(Object other) {
|
||||
EntityUniqueKey that = (EntityUniqueKey) other;
|
||||
return that.entityName.equals( entityName )
|
||||
return that != null && that.entityName.equals( entityName )
|
||||
&& that.uniqueKeyName.equals( uniqueKeyName )
|
||||
&& keyType.isEqual( that.key, key );
|
||||
}
|
||||
|
|
|
@ -216,7 +216,7 @@ public final class IdentityMap<K,V> implements Map<K,V> {
|
|||
@SuppressWarnings( {"EqualsWhichDoesntCheckParameterClass"})
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return key == ( (IdentityKey) other ).key;
|
||||
return other != null && key == ( (IdentityKey) other ).key;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -817,7 +817,7 @@ public class JoinWalker {
|
|||
@Override
|
||||
public boolean equals(Object other) {
|
||||
AssociationKey that = (AssociationKey) other;
|
||||
return that.table.equals( table ) && Arrays.equals( columns, that.columns );
|
||||
return that != null && that.table.equals( table ) && Arrays.equals( columns, that.columns );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -869,7 +869,7 @@ public class Table implements RelationalModel, Serializable, Exportable {
|
|||
|
||||
public boolean equals(Object other) {
|
||||
ForeignKeyKey fkk = (ForeignKeyKey) other;
|
||||
return fkk.columns.equals( columns ) && fkk.referencedColumns.equals( referencedColumns );
|
||||
return fkk != null && fkk.columns.equals( columns ) && fkk.referencedColumns.equals( referencedColumns );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -118,7 +118,7 @@ public class ConcurrentServiceBinding<K,V> {
|
|||
//so just let it happen as a form of assertion.
|
||||
final Entry<K,V> other = (Entry<K,V>)obj;
|
||||
//Reference equality on the key only!
|
||||
return other.key == this.key;
|
||||
return other != null && other.key == this.key;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -130,7 +130,7 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return getClass().equals( obj.getClass() );
|
||||
return obj != null && getClass().equals( obj.getClass() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue