tracker issue : CF-4121625

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

replacelist does not work with safe navigation

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): James Mohler / James Mohler (James Mohler)

Created: 02/25/2016

Components: Language

Versions: 2016

Failure Type: Crash

Found In Build/Fixed In Build: CF2016_Final /

Priority/Frequency: Critical / All users will encounter

Locale/System: ALL / Mac 10.11

Vote Count: 0

Problem Description:


Steps to Reproduce:

body = body.replacelist("~/", "#Bootstrap?.actionRoot#")



Actual Result:

Error. See attachement

Expected Result:

I expect that

"#Bootstrap?.actionRoot#"

would be treated as a blank string when actionRoot does not exist. For that matter, I expect


Bootstrap?.actionRoot

to be treated like a blank string.


Any Workarounds:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4121625

External Customer Info:
External Company:  
External Customer Name: James Mohler
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

  1. February 25, 2016 00:00:00: 1_Untitled.png

Comments:

No. You just don't get it James (this is demonstrated by earllier tickets on this topic). ?. does not magically give something a value where it doesn't have one. It just returns null as soon as an operand is null. So you will either get the value of the object identified by left?.right, or null. It's not the "invent a value" operator, it's the safe navigation operator. What you're *really* raising here is that you want null to be analogous to an empty string, which is an entirely different issue.
Comment by External U.
4466 | February 25, 2016 03:33:36 AM GMT
This is an expected behavior and hence closing it as NotABug.
Comment by Suchika S.
4467 | February 25, 2016 04:35:23 AM GMT