Changeset 11929 in josm


Ignore:
Timestamp:
2017-04-16T14:50:24+02:00 (6 months ago)
Author:
Don-vip
Message:

PMD - disable "InefficientEmptyStringCheck"

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/template_engine/TemplateParser.java

    r10378 r11929  
    9595            condition = parseExpression(CONDITION_WITH_APOSTROPHES_END_TOKENS);
    9696            check(TokenType.APOSTROPHE);
    97             if (searchExpression.getText().trim().isEmpty()) {
     97            String searchText = searchExpression.getText().trim();
     98            if (searchText.isEmpty()) {
    9899                result.getEntries().add(condition);
    99100            } else {
    100101                try {
    101102                    result.getEntries().add(new SearchExpressionCondition(
    102                             SearchCompiler.compile(searchExpression.getText()), condition));
     103                            SearchCompiler.compile(searchText), condition));
    103104                } catch (SearchCompiler.ParseError e) {
    104105                    throw new ParseError(searchExpression.getPosition(), e);
     
    125126        check(TokenType.APOSTROPHE);
    126127        ContextSwitchTemplate result;
    127         if (searchExpression.getText().trim().isEmpty())
     128        String searchText = searchExpression.getText().trim();
     129        if (searchText.isEmpty())
    128130            throw new ParseError(tr("Expected search expression"));
    129131        else {
    130132            try {
    131                 Match match = SearchCompiler.compile(searchExpression.getText());
     133                Match match = SearchCompiler.compile(searchText);
    132134                result = new ContextSwitchTemplate(match, template, searchExpression.getPosition());
    133135            } catch (SearchCompiler.ParseError e) {
  • trunk/tools/pmd/josm-ruleset.xml

    r11746 r11929  
    3232        <exclude name="StringToString"/>
    3333        <exclude name="UselessStringValueOf"/>
     34        <exclude name="InefficientEmptyStringCheck"/>
    3435  </rule>
    3536  <rule ref="rulesets/java/typeresolution.xml">
Note: See TracChangeset for help on using the changeset viewer.