Index: trunk/src/org/openstreetmap/josm/tools/template_engine/TemplateParser.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/template_engine/TemplateParser.java	(revision 11928)
+++ trunk/src/org/openstreetmap/josm/tools/template_engine/TemplateParser.java	(revision 11929)
@@ -95,10 +95,11 @@
             condition = parseExpression(CONDITION_WITH_APOSTROPHES_END_TOKENS);
             check(TokenType.APOSTROPHE);
-            if (searchExpression.getText().trim().isEmpty()) {
+            String searchText = searchExpression.getText().trim();
+            if (searchText.isEmpty()) {
                 result.getEntries().add(condition);
             } else {
                 try {
                     result.getEntries().add(new SearchExpressionCondition(
-                            SearchCompiler.compile(searchExpression.getText()), condition));
+                            SearchCompiler.compile(searchText), condition));
                 } catch (SearchCompiler.ParseError e) {
                     throw new ParseError(searchExpression.getPosition(), e);
@@ -125,9 +126,10 @@
         check(TokenType.APOSTROPHE);
         ContextSwitchTemplate result;
-        if (searchExpression.getText().trim().isEmpty())
+        String searchText = searchExpression.getText().trim();
+        if (searchText.isEmpty())
             throw new ParseError(tr("Expected search expression"));
         else {
             try {
-                Match match = SearchCompiler.compile(searchExpression.getText());
+                Match match = SearchCompiler.compile(searchText);
                 result = new ContextSwitchTemplate(match, template, searchExpression.getPosition());
             } catch (SearchCompiler.ParseError e) {
Index: trunk/tools/pmd/josm-ruleset.xml
===================================================================
--- trunk/tools/pmd/josm-ruleset.xml	(revision 11928)
+++ trunk/tools/pmd/josm-ruleset.xml	(revision 11929)
@@ -32,4 +32,5 @@
   	<exclude name="StringToString"/>
   	<exclude name="UselessStringValueOf"/>
+  	<exclude name="InefficientEmptyStringCheck"/>
   </rule>
   <rule ref="rulesets/java/typeresolution.xml">
