#773 Handling unsuccessful mapping between HTimeZone and BTimeZone to last resort UCT tz

Victor Smolinski Tue 31 Dec 2019

Hi, we're using nhaystack-ax ver:2.0 in this particular case.

We recently had an issue where our requests to hisRead would fail due to an unmapped BTimeZone.

I found the fromBajaTimeZone method (NHServer.java line 538), where it handles a non-Olsen compliant BTimeZone, but if no mappings are defined it fails. I would like to commit a small addon to this method where if no mappings are found on the NHaystackService's property sheet, we assign a last resort timezone of UCT. So history data can still be queried even with a mismatched timezone, perhaps informing the user on the Niagara View of the potential conflict between timezones, but still allowing history data flow.

`

try
{
    return HTimeZone.make(tzName);
}
catch (Exception e)
{
    // look through the aliases
    BTimeZoneAlias[] aliases = service.getTimeZoneAliases().getAliases();
    for (int i = 0; i < aliases.length; i++)
    {
        if (aliases[i].getAxTimeZoneId().equals(timeZone.getId()))
            return aliases[i].getHaystackTimeZone().getTimeZone();
    }
    //TODO : try to return  a UCT HTimeZone here !!
    // cannot create timezone tag
    LOG.error("Cannot create tz tag: " + e.getMessage());
    return null;
}
}

`

Richard McElhinney Fri 3 Jan 2020

Hi Victor,

If you would like to create a Pull Request and also include some automated tests I can have a look at getting the code merged across.

Let me know if you have any questions.

Cheers, Richard

Victor Smolinski Fri 3 Jan 2020

will do, thanks.

Login or Signup to reply.