Troubleshooting frozen object in tzinfo_timezone

Discussion in 'Ruby' started by Morten, Jan 30, 2007.

  1. Morten

    Morten Guest

    Hi. Off and on I get a "can't modify frozen object" when working with
    the tzinfo_timezone plugin. I've added some debugging in the code to try
    and track down what goes wrong:

    def tzinfo
    RAILS_DEFAULT_LOGGER.debug("TZINFO STATE '#{@tzinfo}' class
    #{@tzinfo.class} frozen? #{@tzinfo.frozen?}")
    return @tzinfo if @tzinfo
    RAILS_DEFAULT_LOGGER.debug("TZINFO ASSIGN TO #{MAPPING[name]}")
    begin
    @tzinfo = MAPPING[name]
    rescue TypeError => type_error
    RAILS_DEFAULT_LOGGER.debug("TZINFO TYPE ERROR #{type_error}")
    raise type_error
    end
    RAILS_DEFAULT_LOGGER.debug("TZINFO ASSIGNED TO #{@tzinfo}")
    if String === @tzinfo
    @tzinfo = TZInfo::Timezone.get(@tzinfo)
    MAPPING[name] = @tzinfo
    end
    @tzinfo
    end


    When the error occurs, the following makes it to the log:

    TZINFO STATE '' class NilClass frozen? false
    TZINFO ASSIGN TO Europe/Amsterdam
    TZINFO TYPE ERROR can't modify frozen object

    Which means, that @tzinfo is nil, and yet, the line

    @tzinfo = MAPPING[name]

    Causes a TypeError. MAPPING is a hash. I'm mildly confused. Anyone able
    to shed some light on what might be the issue or how to dig further into
    the problem?

    ruby 1.8.4 (2005-12-24) [x86_64-linux]

    Thanks.

    Morten
    Morten, Jan 30, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TG9yaSBNY0RvbmFsZA==?=

    Troubleshooting Object Reference Not Set to Instance of an Object

    =?Utf-8?B?TG9yaSBNY0RvbmFsZA==?=, Apr 9, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    480
    MS News \(MS ILM\)
    Apr 10, 2004
  2. Paul
    Replies:
    3
    Views:
    517
  3. est
    Replies:
    1
    Views:
    550
  4. Elias Athanasopoulos

    modify a frozen object

    Elias Athanasopoulos, Nov 13, 2003, in forum: Ruby
    Replies:
    0
    Views:
    80
    Elias Athanasopoulos
    Nov 13, 2003
  5. LC Geldenhuys
    Replies:
    5
    Views:
    257
    Robert Klemme
    Feb 18, 2004
Loading...

Share This Page