tracker issue : CF-3851484

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

[ANeff] Bug for: isValid() inconsistent handling of NULL

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/Duplicate

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

Created: 11/13/2014

Components: Language

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Win All

Vote Count: 0

Duplicate ID:	CF-3854303

Problem: isValid("type", NULL) returns NO for all types -except-:

1) isValid("any", javaCast("null", "")) returns "YES" (good)
2) isValid("eurodate", javaCast("null", "")) returns YES (bad - should return NO)
3) isValid("integer", javaCast("null", "")) returns java.lang.NullPointerException (bad - should return NO)
4) isValid("string", javaCast("null", "")) returns YES (good - I suppose)
5) isValid("USdate", javaCast("null", "")) returns java.lang.NullPointerException (bad - should return NO)

Expected result: #2 and #5 should return NO especially since isDate(javaCast("null", "")) returns NO.  #3 should return NO (instead of exception) especially since isValid("numeric", javaCast("null", "")) doesn't throw an exception.

Repro:

<cfscript>
  for(type in "any,array,binary,boolean,component,creditcard,date,time,email,eurodate,numeric,guid,integer,query,ssn,social_security_number,string,struct,telephone,URL,UUID,USdate,variableName,zipcode") {
	  try {
		  writeOutput('<p>isValid("#type#", javaCast("null", "")): ' & isValid(type, javaCast("null", "")) & '</p>');
	  }
	  catch(any e) {
		  writeOutput('<p>isValid("#type#", javaCast("null", "")):');
		  writeDump(e.type);
	  }
  }
  writeOutput('<p>isValid("range", javaCast("null", ""), 1, 2): ' & isValid("range", javaCast("null", ""), 1, 2) & '</p>');
  writeOutput('<p>isValid("regex", javaCast("null", ""), "asdf"): ' & isValid("regex", javaCast("null", ""), "asdf") & '</p>');
  writeOutput('<p>isValid("regular_expression", javaCast("null", ""), "asdf"): ' & isValid("regular_expression", javaCast("null", ""), "asdf") & '</p>');
  writeOutput('<p>isNumeric(javaCast("null", "")): ' & isNumeric(javaCast("null", "")) & '</p>');
  writeOutput('<p>isDate(javaCast("null", "")): ' & isDate(javaCast("null", "")) & '</p>');
</cfscript>

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

Watson Bug ID:	3851484

External Customer Info:
External Company:  
External Customer Name: itisdesign
External Customer Email:

Attachments:

Comments:

Thanks for raising this bug. Due to the diversity of the bug, I have raised two separate bugs to better track this issue - CF-3854303 and CF-3854304. I will be closing this bug as a duplicate.
Comment by Immanuel N.
10112 | November 19, 2014 12:21:20 PM GMT