Author: markt Date: Tue Apr 19 11:44:12 2011 New Revision: 1095052 URL: http://svn.apache.org/viewvc?rev=1095052&view=rev Log: Minor optimisation reported by FindBugs
Modified: tomcat/trunk/java/org/apache/jasper/compiler/TextOptimizer.java Modified: tomcat/trunk/java/org/apache/jasper/compiler/TextOptimizer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TextOptimizer.java?rev=1095052&r1=1095051&r2=1095052&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/TextOptimizer.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/TextOptimizer.java Tue Apr 19 11:44:12 2011 @@ -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); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org