Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[buckminster-dev] NPE in BillOfMaterials.contentEqual()

Hello,
 
what about changing
 
/**
* Compares the two instances for equality without taking the creation date
* into account.
* @param other The instance that this instance is compared to
* @return true if the contents of the two instances is equal, not counting the creation date
*/
public boolean contentEqual(BillOfMaterials other)
{
    return m_queryId.equals(other.m_queryId) && m_topNodeId.equals(other.m_topNodeId);
}
 
to
 
/**
* Compares the two instances for equality without taking the creation date
* into account.
* @param other The instance that this instance is compared to
* @return true if the contents of the two instances is equal, not counting the creation date
*/
public boolean contentEqual(BillOfMaterials other)
{
    return other != null && m_queryId.equals(other.m_queryId) && m_topNodeId.equals(other.m_topNodeId);
}
 
to avoid possible NPE if a null "other" is passed in?
 
Regards
  Filip
 

Back to the top