poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 63234] XSSFFont.equals, hashCode very slow; revised code presented
Date Fri, 08 Mar 2019 15:55:14 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=63234

--- Comment #5 from David Gauntt <dmgauntt@uab.edu> ---
I found a bug in my proposed code for XSSFFont.equals.  If hashCode() had not
been called before calling equals(), a NullPointException would have been
thrown.

The code below replaces the reference to _hashCode with a call to hashCode()

        @Override
        public boolean equals(Object o) {
                if (this == o) {
                        return true;
                }
                if (!(o instanceof XSSFFont)) {
                        return false;
                }

                //if (_hashCode != o.hashCode()) {

                if (hashCode() != o.hashCode()) {
                        return false;
                }

                XSSFFont cf = (XSSFFont) o;
                return toString().equals(cf.toString());
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message