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

sonar - squid:S1226 - Method parameters, caught exceptions and foreach variables should not be reassigned

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java

    r10923 r10965  
    157157            return false;
    158158        }
    159         domain = unicodeToASCII(domain);
     159        String asciiDomain = unicodeToASCII(domain);
    160160        // hosts must be equally reachable via punycode and Unicode
    161161        // Unicode is never shorter than punycode, so check punycode
    162162        // if domain did not convert, then it will be caught by ASCII
    163163        // checks in the regexes below
    164         if (domain.length() > MAX_DOMAIN_LENGTH) {
     164        if (asciiDomain.length() > MAX_DOMAIN_LENGTH) {
    165165            return false;
    166166        }
    167         String[] groups = domainRegex.match(domain);
     167        String[] groups = domainRegex.match(asciiDomain);
    168168        if (groups != null && groups.length > 0) {
    169169            return isValidTld(groups[0]);
    170170        }
    171         return allowLocal && hostnameRegex.isValid(domain);
     171        return allowLocal && hostnameRegex.isValid(asciiDomain);
    172172    }
    173173
     
    183183            return false;
    184184        }
    185         domain = unicodeToASCII(domain);
     185        String asciiDomain = unicodeToASCII(domain);
    186186        // hosts must be equally reachable via punycode and Unicode
    187187        // Unicode is never shorter than punycode, so check punycode
    188188        // if domain did not convert, then it will be caught by ASCII
    189189        // checks in the regexes below
    190         if (domain.length() > MAX_DOMAIN_LENGTH) {
     190        if (asciiDomain.length() > MAX_DOMAIN_LENGTH) {
    191191            return false;
    192192        }
    193         String[] groups = domainRegex.match(domain);
     193        String[] groups = domainRegex.match(asciiDomain);
    194194        return (groups != null && groups.length > 0)
    195                 || hostnameRegex.isValid(domain);
     195                || hostnameRegex.isValid(asciiDomain);
    196196    }
    197197
     
    204204     */
    205205    public boolean isValidTld(String tld) {
    206         tld = unicodeToASCII(tld);
    207         if (allowLocal && isValidLocalTld(tld)) {
     206        String asciiTld = unicodeToASCII(tld);
     207        if (allowLocal && isValidLocalTld(asciiTld)) {
    208208            return true;
    209209        }
    210         return isValidInfrastructureTld(tld)
    211                 || isValidGenericTld(tld)
    212                 || isValidCountryCodeTld(tld);
     210        return isValidInfrastructureTld(asciiTld)
     211                || isValidGenericTld(asciiTld)
     212                || isValidCountryCodeTld(asciiTld);
    213213    }
    214214
Note: See TracChangeset for help on using the changeset viewer.