Changeset 18635 in josm


Ignore:
Timestamp:
2023-01-17T14:13:17+01:00 (22 months ago)
Author:
taylor.smock
Message:

Fix #22626: Geotagged images from GPX files cannot be closed when rotated by exif data

This is due to the initial implementation of RemoteEntry#equals using the
width and height fields for calculating hashCode and equals. Since we may
set those two fields when showing the image, it does not make sense to use
them for hashCode or equals.

Location:
trunk
Files:
2 edited

Legend:

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

    r18622 r18635  
    334334    @Override
    335335    public int hashCode() {
    336         return Objects.hash(this.uri, this.width, this.height, this.pos,
     336        return Objects.hash(this.uri, this.pos,
    337337                this.exifOrientation, this.elevation, this.speed, this.exifImgDir,
    338338                this.exifCoor, this.exifTime, this.exifGpsTime, this.gpsTime,
     
    349349            RemoteEntry other = this.getClass().cast(obj);
    350350            return Objects.equals(this.uri, other.uri)
    351                     && this.height == other.height
    352                     && this.width == other.width
    353351                    && Objects.equals(this.elevation, other.elevation)
    354352                    && Objects.equals(this.exifCoor, other.exifCoor)
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/RemoteEntryTest.java

    r18622 r18635  
    2020                () -> null, () -> null, () -> null, () -> null);
    2121        EqualsVerifier.simple().forClass(RemoteEntry.class).usingGetClass()
    22                 .withIgnoredFields("firstImage", "lastImage", "nextImage", "previousImage")
     22                .withIgnoredFields("firstImage", "lastImage", "nextImage", "previousImage" /* These suppliers don't have good == semantics */,
     23                        "width", "height" /* Width and height can be corrected later, although it is originally from exif, see #22626 */)
    2324                .withNonnullFields("uri")
    2425                .withPrefabValues(RemoteEntry.class, remoteEntryA, remoteEntryB)
Note: See TracChangeset for help on using the changeset viewer.