Changeset 10292 in josm for trunk


Ignore:
Timestamp:
2016-05-28T23:16:07+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S2275 - Format specifiers should be used instead of string concatenation

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java

    r10216 r10292  
    261261            // US locale to force decimal separator to be '.'
    262262            try (Formatter us = new Formatter(Locale.US)) {
    263                 tOffset.setText(us.format(
    264                     "%1." + precision + "f; %1." + precision + 'f',
     263                tOffset.setText(us.format(new StringBuilder()
     264                    .append("%1.").append(precision).append("f; %1.").append(precision).append('f').toString(),
    265265                    layer.getDx(), layer.getDy()).toString());
    266266            }
  • trunk/src/org/openstreetmap/josm/data/SystemOfMeasurement.java

    r10215 r10292  
    268268            return format.format(v) + ' ' + unit;
    269269        }
    270         return String.format(Locale.US, "%." + (v < 9.999999 ? 2 : 1) + "f %s", v, unit);
     270        return String.format(Locale.US, v < 9.999999 ? "%.2f %s" : "%.1f %s", v, unit);
    271271    }
    272272}
Note: See TracChangeset for help on using the changeset viewer.