From 3b34ed93057b97e12733545ee400093ea36a065e Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 19 Apr 2011 11:44:12 +0000 Subject: [PATCH] Minor optimisation reported by FindBugs git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1095052 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/jasper/compiler/TextOptimizer.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/java/org/apache/jasper/compiler/TextOptimizer.java b/java/org/apache/jasper/compiler/TextOptimizer.java index e6af9ab0b..3d7415017 100644 --- a/java/org/apache/jasper/compiler/TextOptimizer.java +++ b/java/org/apache/jasper/compiler/TextOptimizer.java @@ -28,12 +28,13 @@ public class TextOptimizer { */ static class TextCatVisitor extends Node.Visitor { + private static final String EMPTY_TEXT = ""; + private Options options; private PageInfo pageInfo; private int textNodeCount = 0; private Node.TemplateText firstTextNode = null; private StringBuilder textBuffer; - private final String emptyText = ""; public TextCatVisitor(Compiler compiler) { options = compiler.getCompilationContext().getOptions(); @@ -82,7 +83,7 @@ public class TextOptimizer { public void visit(Node.TemplateText n) throws JasperException { if ((options.getTrimSpaces() || pageInfo.isTrimDirectiveWhitespaces()) && n.isAllSpace()) { - n.setText(emptyText); + n.setText(EMPTY_TEXT); return; } @@ -92,7 +93,7 @@ public class TextOptimizer { } else { // Append text to text buffer textBuffer.append(n.getText()); - n.setText(emptyText); + n.setText(EMPTY_TEXT); } } -- 2.11.0