You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/04/19 13:44:12 UTC
svn commit: r1095052 -
/tomcat/trunk/java/org/apache/jasper/compiler/TextOptimizer.java
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org