Changeset 18622 in josm


Ignore:
Timestamp:
2023-01-03T21:28:24+01:00 (23 months ago)
Author:
taylor.smock
Message:

Fix #22625: SOE in ImageViewer

This was fallout from reworking #21605 -- originally the code did not use
equals. Since it now uses equals, RemoteEntry either needed to be the same
(for object equality) or have an implemented equals method.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/RemoteEntry.java

    r18613 r18622  
    331331        this.title = text;
    332332    }
     333
     334    @Override
     335    public int hashCode() {
     336        return Objects.hash(this.uri, this.width, this.height, this.pos,
     337                this.exifOrientation, this.elevation, this.speed, this.exifImgDir,
     338                this.exifCoor, this.exifTime, this.exifGpsTime, this.gpsTime,
     339                this.iptcObjectName, this.iptcCaption, this.iptcHeadline, this.iptcKeywords,
     340                this.projection, this.title);
     341    }
     342
     343    @Override
     344    public boolean equals(Object obj) {
     345        if (super.equals(obj)) {
     346            return true;
     347        }
     348        if (obj != null && obj.getClass() == this.getClass()) {
     349            RemoteEntry other = this.getClass().cast(obj);
     350            return Objects.equals(this.uri, other.uri)
     351                    && this.height == other.height
     352                    && this.width == other.width
     353                    && Objects.equals(this.elevation, other.elevation)
     354                    && Objects.equals(this.exifCoor, other.exifCoor)
     355                    && Objects.equals(this.exifGpsTime, other.exifGpsTime)
     356                    && Objects.equals(this.exifImgDir, other.exifImgDir)
     357                    && Objects.equals(this.exifOrientation, other.exifOrientation)
     358                    && Objects.equals(this.exifTime, other.exifTime)
     359                    && Objects.equals(this.gpsTime, other.gpsTime)
     360                    && Objects.equals(this.iptcCaption, other.iptcCaption)
     361                    && Objects.equals(this.iptcHeadline, other.iptcHeadline)
     362                    && Objects.equals(this.iptcKeywords, other.iptcKeywords)
     363                    && Objects.equals(this.iptcObjectName, other.iptcObjectName)
     364                    && Objects.equals(this.pos, other.pos)
     365                    && Objects.equals(this.projection, other.projection)
     366                    && Objects.equals(this.speed, other.speed)
     367                    && Objects.equals(this.title, other.title);
     368        }
     369        return false;
     370    }
    333371}
Note: See TracChangeset for help on using the changeset viewer.