Ignore:
Timestamp:
2015-05-03T18:34:33+02:00 (9 years ago)
Author:
Don-vip
Message:

fix various Sonar issues:

  • squid:S1068: Unused private fields should be removed
  • squid:S1155: Collection.isEmpty() should be used to test for emptiness
  • squid:S1185: Overriding methods should do more than simply call the same method in the super class
  • squid:S1694: An abstract class should have both abstract and concrete methods
  • squid:S1905: Redundant casts should not be used
  • squid:S2065: Fields in non-serializable classes should not be "transient"
  • squid:S2583: Conditions should not unconditionally evaluate to "TRUE" or to "FALSE"
  • squid:ModifiersOrderCheck: Modifiers should be declared in the correct order
Location:
trunk/src/org/openstreetmap/josm/gui/layer/geoimage
Files:
2 edited

Legend:

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

    r8308 r8318  
    999999
    10001000            // no images found, exit
    1001             if(imgs.size() <= 0) {
     1001            if(imgs.isEmpty()) {
    10021002                JOptionPane.showMessageDialog(Main.parent,
    10031003                        tr("The selected photos do not contain time information."),
     
    12071207        // before the first point will be geotagged with the starting point
    12081208        if (prevWpTime == 0 || curWpTime <= prevWpTime) {
    1209             while (true) {
    1210                 if (i < 0) {
    1211                     break;
    1212                 }
     1209            while (i >= 0) {
    12131210                final ImageEntry curImg = images.get(i);
    12141211                long time = curImg.getExifTime().getTime();
     
    12311228        // This code gives a simple linear interpolation of the coordinates between current and
    12321229        // previous track point assuming a constant speed in between
    1233         while (true) {
    1234             if (i < 0) {
    1235                 break;
    1236             }
     1230        while (i >= 0) {
    12371231            ImageEntry curImg = images.get(i);
    12381232            long imgTime = curImg.getExifTime().getTime();
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r8285 r8318  
    713713
    714714    public void showNextPhoto() {
    715         if (data != null && data.size() > 0) {
     715        if (data != null && !data.isEmpty()) {
    716716            currentPhoto++;
    717717            if (currentPhoto >= data.size()) {
     
    739739
    740740    public void showFirstPhoto() {
    741         if (data != null && data.size() > 0) {
     741        if (data != null && !data.isEmpty()) {
    742742            currentPhoto = 0;
    743743            ImageViewerDialog.showImage(this, data.get(currentPhoto));
     
    749749
    750750    public void showLastPhoto() {
    751         if (data != null && data.size() > 0) {
     751        if (data != null && !data.isEmpty()) {
    752752            currentPhoto = data.size() - 1;
    753753            ImageViewerDialog.showImage(this, data.get(currentPhoto));
     
    764764
    765765    public void removeCurrentPhoto() {
    766         if (data != null && data.size() > 0 && currentPhoto >= 0 && currentPhoto < data.size()) {
     766        if (data != null && !data.isEmpty() && currentPhoto >= 0 && currentPhoto < data.size()) {
    767767            data.remove(currentPhoto);
    768768            if (currentPhoto >= data.size()) {
     
    781781    public void removeCurrentPhotoFromDisk() {
    782782        ImageEntry toDelete = null;
    783         if (data != null && data.size() > 0 && currentPhoto >= 0 && currentPhoto < data.size()) {
     783        if (data != null && !data.isEmpty() && currentPhoto >= 0 && currentPhoto < data.size()) {
    784784            toDelete = data.get(currentPhoto);
    785785
     
    828828    public void copyCurrentPhotoPath() {
    829829        ImageEntry toCopy = null;
    830         if (data != null && data.size() > 0 && currentPhoto >= 0 && currentPhoto < data.size()) {
     830        if (data != null && !data.isEmpty() && currentPhoto >= 0 && currentPhoto < data.size()) {
    831831            toCopy = data.get(currentPhoto);
    832832            String copyString = toCopy.getFile().toString();
Note: See TracChangeset for help on using the changeset viewer.