Changeset 10046 in josm for trunk


Ignore:
Timestamp:
2016-03-26T15:20:07+01:00 (9 years ago)
Author:
Don-vip
Message:

sonar - squid:S1449 - Locale should be used in String operations
sonar - squid:S2177 - Child class methods named for parent class methods should be overrides

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedNode.java

    r9693 r10046  
    44import static org.openstreetmap.josm.tools.I18n.marktr;
    55import static org.openstreetmap.josm.tools.I18n.tr;
     6
     7import java.util.Locale;
    68
    79import org.openstreetmap.josm.command.Command;
     
    5254    @Override
    5355    public void visitKeyValue(AbstractPrimitive n, String key, String value) {
    54         if (key.toLowerCase().contains("fixme") || value.toLowerCase().contains("fixme")) {
     56        if (key.toLowerCase(Locale.ENGLISH).contains("fixme") || value.toLowerCase(Locale.ENGLISH).contains("fixme")) {
    5557            /* translation note: don't translate quoted words */
    5658            String msg = marktr("Has tag containing ''fixme'' or ''FIXME''");
  • trunk/src/org/openstreetmap/josm/gui/widgets/JosmImageView.java

    r9665 r10046  
    4141     * @throws NoSuchFieldException see {@link Class#getDeclaredField} for details
    4242     */
    43     public JosmImageView(Element elem) throws NoSuchFieldException, SecurityException {
     43    public JosmImageView(Element elem) throws NoSuchFieldException {
    4444        super(elem);
    4545        imageField = ImageView.class.getDeclaredField("image");
     
    5656     * Makes sure the necessary properties and image is loaded.
    5757     */
    58     private void sync() {
     58    private void doSync() {
    5959        try {
    6060            int s = (int) stateField.get(this);
    6161            if ((s & RELOAD_IMAGE_FLAG) != 0) {
    62                 refreshImage();
     62                doRefreshImage();
    6363            }
    6464            s = (int) stateField.get(this);
     
    8585     * @throws SecurityException see {@link Class#getDeclaredMethod} for details
    8686     */
    87     private void refreshImage() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException,
    88         NoSuchMethodException, SecurityException {
     87    private void doRefreshImage() throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    8988        synchronized (this) {
    9089            // clear out width/height/reloadimage flag and set loading flag
     
    9998        try {
    10099            // Load the image
    101             loadImage();
     100            doLoadImage();
    102101
    103102            // And update the size params
     
    122121     * @throws SecurityException see {@link Class#getDeclaredMethod} for details
    123122     */
    124     private void loadImage() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException,
    125         NoSuchMethodException, SecurityException {
     123    private void doLoadImage() throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    126124        URL src = getImageURL();
    127125        if (src != null) {
     
    142140    @Override
    143141    public Image getImage() {
    144         sync();
     142        doSync();
    145143        return super.getImage();
    146144    }
     
    148146    @Override
    149147    public AttributeSet getAttributes() {
    150         sync();
     148        doSync();
    151149        return super.getAttributes();
    152150    }
     
    154152    @Override
    155153    public void paint(Graphics g, Shape a) {
    156         sync();
     154        doSync();
    157155        super.paint(g, a);
    158156    }
     
    160158    @Override
    161159    public float getPreferredSpan(int axis) {
    162         sync();
     160        doSync();
    163161        return super.getPreferredSpan(axis);
    164162    }
     
    166164    @Override
    167165    public void setSize(float width, float height) {
    168         sync();
     166        doSync();
    169167        super.setSize(width, height);
    170168    }
Note: See TracChangeset for help on using the changeset viewer.