Ignore:
Timestamp:
2024-06-11T23:53:20+02:00 (5 months ago)
Author:
taylor.smock
Message:

Cleanup some new PMD warnings from PMD 7.x

I haven't updated to PMD 7.x in ivy/maven yet since I still have 83 PMD violations
to go through, and I don't know (yet) if any of them were supposed to be ignored
by the xpath expressions in tools/pmd/josm-ruleset.xml.

I may re-enable some of the PMD checks I've temporarily disabled prior to committing
the update for PMD.

Additionally cleanup some SonarLint issues in the modified files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ExifReader.java

    r18315 r19101  
    2323import com.drew.metadata.exif.ExifDirectoryBase;
    2424import com.drew.metadata.exif.ExifIFD0Directory;
    25 import com.drew.metadata.exif.ExifSubIFDDirectory;
    2625import com.drew.metadata.exif.GpsDirectory;
    2726import com.drew.metadata.iptc.IptcDirectory;
     
    7675                }
    7776                for (Tag tag : dirIt.getTags()) {
    78                     if (tag.getTagType() == ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL /* 0x9003 */ &&
    79                             !tag.getDescription().matches("\\[[0-9]+ .+\\]")) {
     77                    if (tag.getTagType() == ExifDirectoryBase.TAG_DATETIME_ORIGINAL /* 0x9003 */ &&
     78                            !tag.getDescription().matches("\\[\\d+ .+]")) {
    8079                        dateTimeOrig = tag.getDescription();
    81                     } else if (tag.getTagType() == ExifIFD0Directory.TAG_DATETIME /* 0x0132 */) {
     80                    } else if (tag.getTagType() == ExifDirectoryBase.TAG_DATETIME /* 0x0132 */) {
    8281                        dateTime = tag.getDescription();
    83                     } else if (tag.getTagType() == ExifSubIFDDirectory.TAG_DATETIME_DIGITIZED /* 0x9004 */) {
     82                    } else if (tag.getTagType() == ExifDirectoryBase.TAG_DATETIME_DIGITIZED /* 0x9004 */) {
    8483                        dateTimeDig = tag.getDescription();
    85                     } else if (tag.getTagType() == ExifSubIFDDirectory.TAG_SUBSECOND_TIME_ORIGINAL /* 0x9291 */) {
     84                    } else if (tag.getTagType() == ExifDirectoryBase.TAG_SUBSECOND_TIME_ORIGINAL /* 0x9291 */) {
    8685                        subSecOrig = tag.getDescription();
    87                     } else if (tag.getTagType() == ExifSubIFDDirectory.TAG_SUBSECOND_TIME /* 0x9290 */) {
     86                    } else if (tag.getTagType() == ExifDirectoryBase.TAG_SUBSECOND_TIME /* 0x9290 */) {
    8887                        subSec = tag.getDescription();
    89                     } else if (tag.getTagType() == ExifSubIFDDirectory.TAG_SUBSECOND_TIME_DIGITIZED /* 0x9292 */) {
     88                    } else if (tag.getTagType() == ExifDirectoryBase.TAG_SUBSECOND_TIME_DIGITIZED /* 0x9292 */) {
    9089                        subSecDig = tag.getDescription();
    9190                    }
     
    145144            final Metadata metadata = JpegMetadataReader.readMetadata(filename);
    146145            final Directory dir = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
    147             return dir == null ? null : dir.getInteger(ExifIFD0Directory.TAG_ORIENTATION);
     146            return dir == null ? null : dir.getInteger(ExifDirectoryBase.TAG_ORIENTATION);
    148147        } catch (JpegProcessingException | IOException e) {
    149148            Logging.error(e);
     
    316315            if (ele != null) {
    317316                final Integer d = dirGps.getInteger(GpsDirectory.TAG_ALTITUDE_REF);
    318                 if (d != null && d.intValue() == 1) {
     317                if (d != null && d == 1) {
    319318                    ele *= -1;
    320319                }
     
    367366    /**
    368367     * Returns a Transform that fixes the image orientation.
    369      *
     368     * <p>
    370369     * Only orientation 1, 3, 6 and 8 are supported. Everything else is treated as 1.
    371370     * @param orientation the exif-orientation of the image
     
    376375    public static AffineTransform getRestoreOrientationTransform(final int orientation, final int width, final int height) {
    377376        final int q;
    378         final double ax, ay;
     377        final double ax;
     378        final double ay;
    379379        switch (orientation) {
    380380        case 8:
     
    404404     * Check, if the given orientation switches width and height of the image.
    405405     * E.g. 90 degree rotation
    406      *
     406     * <p>
    407407     * Only orientation 1, 3, 6 and 8 are supported. Everything else is treated
    408408     * as 1.
     
    416416    /**
    417417     * Check, if the given orientation requires any correction to the image.
    418      *
     418     * <p>
    419419     * Only orientation 1, 3, 6 and 8 are supported. Everything else is treated
    420420     * as 1.
Note: See TracChangeset for help on using the changeset viewer.