Cannot access a property or method of a null object reference for simple DateFormatter.parseDateString(date);

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot access a property or method of a null object reference for simple DateFormatter.parseDateString(date);

Ramazan Ergüder Bekrek
Greetings to y'all

I have a simple code which us calling DateFormatter for conversion from String to Date like follow:

public static function parseBlobDate(date:String):Date{
                        return DateFormatter.parseDateString(date);
                }

which triggers an error : TypeError: Error #1009: Cannot access a property or method of a null object reference.
        at mx.formatters::DateBase$/get http://www.adobe.com/2006/flex/mx/internal::defaultStringKey()[D:\flex_sdk\Sources\flex-sdk\frameworks\projects\framework\src\mx\formatters\DateBase.as:195]
        at mx.formatters::DateFormatter$/parseDateString()[D:\flex_sdk\Sources\flex-sdk\frameworks\projects\framework\src\mx\formatters\DateFormatter.as:218]

In the function defaultStringKey when I debug to see where the error comes from I noticed that monthNamesLong is null which is unusual.


mx_internal static function get defaultStringKey():Array /* of String */
    {
        initialize();

        return monthNamesLong.concat(timeOfDay);
    }

this code was working before but somehow it is not anymore. What am I doing wrong?


Reply | Threaded
Open this post in threaded view
|

Re: Cannot access a property or method of a null object reference for simple DateFormatter.parseDateString(date);

Ramazan Ergüder Bekrek
You can have a screenshot of what I am talking about.

https://pasteboard.co/ItRpbza.png

22.08.2019, 12:57, "Ramazan Ergüder Bekrek" <[hidden email]>:

> Greetings to y'all
>
> I have a simple code which us calling DateFormatter for conversion from String to Date like follow:
>
> public static function parseBlobDate(date:String):Date{
>                         return DateFormatter.parseDateString(date);
>                 }
>
> which triggers an error : TypeError: Error #1009: Cannot access a property or method of a null object reference.
>         at mx.formatters::DateBase$/get http://www.adobe.com/2006/flex/mx/internal::defaultStringKey()[D:\flex_sdk\Sources\flex-sdk\frameworks\projects\framework\src\mx\formatters\DateBase.as:195]
>         at mx.formatters::DateFormatter$/parseDateString()[D:\flex_sdk\Sources\flex-sdk\frameworks\projects\framework\src\mx\formatters\DateFormatter.as:218]
>
> In the function defaultStringKey when I debug to see where the error comes from I noticed that monthNamesLong is null which is unusual.
>
> mx_internal static function get defaultStringKey():Array /* of String */
>     {
>         initialize();
>
>         return monthNamesLong.concat(timeOfDay);
>     }
>
> this code was working before but somehow it is not anymore. What am I doing wrong?