tracker issue : CF-4201589

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Bug for: ListSort() w/ callback disallows IncludeEmptyFields

| View in Tracker

Status/Resolution/Reason: To Test//DesignLimitation

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff ()

Created: 03/19/2018

Components: Language, Closures

Versions: 2016,11.0,2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2016,0,04,302561 /

Priority/Frequency: Normal / Few users will encounter

Locale/System: / Platforms All

Vote Count: 0

Issue: ListSort() w/ callback disallows IncludeEmptyFields

Steps to Reproduce:

{code:java}
<cfscript>
  list1 = "b|a||c";
  list2 = list1.listSort(function(element1, element2) {
    return element1.compare(element2);
  }, "|", true);
  writeOutput(list2);
</cfscript>
{code}


Actual Result: coldfusion.runtime.InvalidSortTypeException

Expected Result: "|a|b|c"

Bug b/c ListSort()'s callback has no equivalent functionality for this:
{code:java}
<cfscript>
  list1 = "b|a||c";
  writeOutput(list1.listSort("text", "asc", "|", true));//returns "|a|b|c"
</cfscript>
{code}

Attachments:

Comments:

Hi Adobe, In ListFilter(), ListMap() and ListSort(), the first 4 parameters should be `list,callback[,delimiter[,includeEmptyFields]]` (in that order). Issue: ListSort()'s 4th parameter (includeEmptyFields) triggers exception. Can this be fixed in Aether? Thanks!, -Aaron
Comment by Aaron N.
27522 | April 14, 2018 07:48:47 AM GMT
Hi Adobe, This needs fixed in Aether GM. As shown below, ListFilter()'s and ListMap()'s last 2 parameters are "delimiter,includeEmptyFields". So, ListSort()'s syntax must match and needs fixed. <!--- Syntax: list.listFilter(callback, delimiter, includeEmptyFields) ---> <cfscript> list1 = "b|a||c" list2 = list1.listFilter(function(element) { return element != "b" }, "|", true) writeOutput(list2)//returns "a||c" (good) </cfscript> <!--- Syntax: list.listMap(callback, delimiter, includeEmptyFields) ---> <cfscript> list1 = "b|a||c" list2 = list1.listMap(function(element) { return "changed" }, "|", true) writeOutput(list2)//returns "changed|changed|changed|changed" (good) </cfscript> Thanks!, -Aaron
Comment by Aaron N.
27709 | May 07, 2018 11:57:11 PM GMT