Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Adobe Flex SDK Previous
-
None
-
None
-
Affected OS(s): All OS Platforms
Language Found: English
Description
When creating an DateTimeFormatter object in action scripts , and don't set any locale .
then try to get its properties , DateTimePattern, it should return null like others , dateStyle , timeStyle.
however it will get TypeError like below now :
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at spark.formatters::DateTimeFormatter/get dateTimePattern()[C:\GaoMingzhu\Perforce\redcloud.corp.adobe.com_1820\mgao-redcloud1820-win-2\esg\flex\sdk\gs\frameworks\projects\spark\src\spark\formatters\DateTimeFormatter.as:414]
at TestBug/init()[C:\GaoMingzhu\Workspace\flex\TestApp\src\TestBug.mxml:41]
at TestBug/___TestBug_Application1_creationComplete()[C:\GaoMingzhu\Workspace\flex\TestApp\src\TestBug.mxml:5]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[C:\GaoMingzhu\Perforce\redcloud.corp.adobe.com_1820\mgao-redcloud1820-win-2\esg\flex\sdk\gs\frameworks\projects\framework\src\mx\core\UIComponent.as:12896]
at mx.core::UIComponent/set initialized()[C:\GaoMingzhu\Perforce\redcloud.corp.adobe.com_1820\mgao-redcloud1820-win-2\esg\flex\sdk\gs\frameworks\projects\framework\src\mx\core\UIComponent.as:1667]
at mx.managers::LayoutManager/doPhasedInstantiation()[C:\GaoMingzhu\Perforce\redcloud.corp.adobe.com_1820\mgao-redcloud1820-win-2\esg\flex\sdk\gs\frameworks\projects\framework\src\mx\managers\LayoutManager.as:801]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[C:\GaoMingzhu\Perforce\redcloud.corp.adobe.com_1820\mgao-redcloud1820-win-2\esg\flex\sdk\gs\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1124]
I attached a simple code to reproduce this issues , please get it from attachments.
Suggested fix :
Adding "return undefined ; " after locale is not defined. please see :
------------DateTimeFormatter.as----------------
public function get dateTimePattern():String
---------------changed to be : -------------------
public function get dateTimePattern():String
{
if (g11nWorkingInstance)
return g11nWorkingInstance.getDateTimePattern();
if (!localeStyle)
{ fallbackLastOperationStatus = LastOperationStatus.LOCALE_UNDEFINED_ERROR; return undefined ; } return fallbackFormatter.dateTimePattern;
}
------------------------------------------