Changeset 11901 in josm for trunk/src


Ignore:
Timestamp:
2017-04-14T20:23:24+02:00 (8 years ago)
Author:
Don-vip
Message:

PMD - fix some InefficientEmptyStringCheck (new in PMD 5.5.5)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java

    r11746 r11901  
    9797
    9898    /**
    99      * Remebers the fact that the current JOSM user is partially identified
     99     * Remembers the fact that the current JOSM user is partially identified
    100100     * by the user name of its OSM account.
    101101     *
     
    106106    public void setPartiallyIdentified(String userName) {
    107107        CheckParameterUtil.ensureParameterNotNull(userName, "userName");
    108         if (userName.trim().isEmpty())
     108        String trimmedUserName = userName.trim();
     109        if (trimmedUserName.isEmpty())
    109110            throw new IllegalArgumentException(
    110111                    MessageFormat.format("Expected non-empty value for parameter ''{0}'', got ''{1}''", "userName", userName));
    111         this.userName = userName;
     112        this.userName = trimmedUserName;
    112113        userInfo = null;
    113114    }
     
    125126    public void setFullyIdentified(String username, UserInfo userinfo) {
    126127        CheckParameterUtil.ensureParameterNotNull(username, "username");
    127         if (username.trim().isEmpty())
     128        String trimmedUserName = userName.trim();
     129        if (trimmedUserName.isEmpty())
    128130            throw new IllegalArgumentException(tr("Expected non-empty value for parameter ''{0}'', got ''{1}''", "userName", userName));
    129131        CheckParameterUtil.ensureParameterNotNull(userinfo, "userinfo");
    130         this.userName = username;
     132        this.userName = trimmedUserName;
    131133        this.userInfo = userinfo;
    132134    }
Note: See TracChangeset for help on using the changeset viewer.