code: public boolean dnEquals(DirRecord that) throws NamingException {
      if (that == null) {
        throw new NamingException("Null record for dnEquals");
      }
  
      String thisDn = getDn();
      if (thisDn == null) {
        throw new NamingException("No dn for this record");
      }
  
      String thatDn = that.getDn();
      if (thatDn == null) {
        throw new NamingException("That record has no dn");
      }
  
      return (thisDn.equals(thatDn));
    }
docs: Check dns for equality
  
  @param that
  @return boolean
  @throws NamingException