Issue Details (XML | Word | Printable)

Key: JSTL-9
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: tnn
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
jstl

Function endsWith doesn't work correctly.

Created: 23/Jun/13 07:45 AM   Updated: 24/Jun/13 11:19 PM   Resolved: 24/Jun/13 11:19 PM
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Original Estimate: 1 minute
Original Estimate - 1 minute
Remaining Estimate: 1 minute
Remaining Estimate - 1 minute
Time Spent: Not Specified
Time Spent - Not Specified

Tags:
Participants: kchung and tnn


 Description  « Hide

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<c:set var="some" value="abefcdef"/>
${fn:endsWith(some, 'ef')}

It returns false.

It seems ending with 'ef'.



kchung added a comment - 24/Jun/13 11:19 PM

Fixed. Will be integrated on next release.

Project: jstl
Repository: svn
Revision: 95
Author: kchung
Date: 2013-06-24 23:15:38 UTC
Link:

Log Message:
------------
Issue https://java.net/jira/browse/JSTL-9

Revisions:
----------
95

Modified Paths:
---------------
trunk/impl/src/main/java/org/apache/taglibs/standard/functions/Functions.java
trunk/impl

Diffs:
------
Index: trunk/impl/src/main/java/org/apache/taglibs/standard/functions/Functions.java
===================================================================
— trunk/impl/src/main/java/org/apache/taglibs/standard/functions/Functions.java (revision 94)
+++ trunk/impl/src/main/java/org/apache/taglibs/standard/functions/Functions.java (revision 95)
@@ -125,10 +125,7 @@
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()); + return input.endsWith(substring); }

public static String substring(String input, int beginIndex, int endIndex) {
Index: trunk/impl
===================================================================
— trunk/impl (revision 94)
+++ trunk/impl (revision 95)

Property changes on: trunk/impl
___________________________________________________________________
Added: svn:ignore

    1. -0,0 +1 ##
      +target