Author: cbrisson Date: Sun Dec 11 10:37:21 2016 New Revision: 1773556 URL: http://svn.apache.org/viewvc?rev=1773556&view=rev Log: [engine] remove an obsolete hack from 2001 in ASTStringLiteral
Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java?rev=1773556&r1=1773555&r2=1773556&view=diff ============================================================================== --- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java (original) +++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java Sun Dec 11 10:37:21 2016 @@ -47,9 +47,6 @@ public class ASTStringLiteral extends Si private String image = ""; - /** true if the string contains a line comment (##) */ - private boolean containsLineComment = false; - /** * @param id */ @@ -122,39 +119,9 @@ public class ASTStringLiteral extends Si if (interpolate) { /* - * if appropriate, tack a space on the end (dreaded <MORE> kludge) - */ - - String interpolateimage; - - /** - * Note - this should really use a regexp to look for [^\]## but - * apparently escaping of line comments isn't working right now anyway. - */ - containsLineComment = (image.indexOf("##") != -1); - - /** - * note. A kludge on a kludge. The first part, Geir calls this the - * dreaded <MORE> kludge. Basically, the use of the <MORE> token eats - * the last character of an interpolated string. EXCEPT when a line - * comment (##) is in the string this isn't an issue. - * - * So, to solve this we look for a line comment. If it isn't found we - * add a space here and remove it later. - */ - if (!containsLineComment) - { - interpolateimage = image + " "; - } - else - { - interpolateimage = image; - } - - /* - * now parse and init the nodeTree + * parse and init the nodeTree */ - StringReader br = new StringReader(interpolateimage); + StringReader br = new StringReader(image); /* * it's possible to not have an initialization context - or we don't @@ -346,20 +313,7 @@ public class ASTStringLiteral extends Si * and return the result as a String */ - String ret = writer.toString(); - - /* - * if appropriate, remove the space from the end (dreaded <MORE> - * kludge part deux) - */ - if (!containsLineComment && ret.length() > 0) - { - return ret.substring(0, ret.length() - 1); - } - else - { - return ret; - } + return writer.toString(); } /**