${fn:endsWith('$21', '1')} returns true, but
${fn:endsWith('$22', '2')} returns false.
Both comparisons should return true.
Standard taglib version is 1.1.2.
Tested on Tomcat 6.0.18 and Glassfish v3.
Created attachment 25101 [details]
JSP which reproduces bug
Drop JSP into web application to see the bug.
Of course, you need standard-taglibs in the classpath.
Wow! Indeed, broken. Can reproduce it with 6.0.24.
In org\apache\taglibs\standard\functions\Functions.java:
public static boolean endsWith(String input, String substring) {
if (input == null) input = "";
if (substring == null) substring = "";
int index = input.indexOf(substring);
if (index == -1) return false;
if (index == 0 && substring.length() == 0) return true;
return (index == input.length() - substring.length());
}
there must be
int index = input.lastIndexOf(substring);
though I more wonder why it does not just use
String.endsWith(String)
like fn:startsWith already does.
Created attachment 25102 [details]
Simpler JSP which reproduces the bug
The bug has nothing to do with dollar sign, so I change the testcase.
The bug has nothing to do with dollar sign, so I changed the bug summary.
This bug is the same as bug #32896
Bug #32896 was fixed in 2005!!! but standard-taglibs project has not released any version since 2004.
*** This bug has been marked as a duplicate of bug 32896 ***