On Thu, 4 Jun 2026 06:15:28 GMT, Sruthy Jayan <[email protected]> wrote:

>> Modern AIX7+ supports full POSIX TZ format (e.g., 
>> TZ=CET-1CEST,M3.5.0,M10.5.0), but the current implementation in 
>> mapPlatformToJavaTimezone() searches the tzmappings file using the complete 
>> string including DST transition rules. The tzmappings file only contains the 
>> base timezone identifier (e.g., CET-1CEST), causing the lookup to fail and 
>> fall back to GMT offset calculation.
>> 
>> This behavior differs from earlier AIX versions and IBM Java 8, which 
>> truncated the TZ string at the first comma before performing the lookup, 
>> successfully mapping to proper IANA timezone IDs.
>> 
>> 
>> Fix include the below : 
>> Refactor the AIX timezone mapping implementation to support both modern and 
>> legacy POSIX TZ formats:
>> 
>> Extract mapping logic into new getJavaTimezoneFromPlatform() helper function
>> Implement two-phase lookup strategy:
>> Phase 1: Attempt to map the full POSIX TZ string (supports modern AIX7+)
>> Phase 2: If no match, truncate at first comma and retry (maintains backward 
>> compatibility)
>> Fall back to GMT offset only if both lookups fail
>> 
>> Exclude AIX from CustomTzIDCheckDST.java (validates POSIX DST rules directly)
>> Add new AIXTzMappingTest.java to validate AIX-specific behavior:
>> Successful mapping: CET-1CEST,M3.5.0,M10.5.0 → Europe/Paris
>> Successful mapping: MEZ-1MESZ,M3.5.0,M10.5.0/3 → Europe/Berlin
>> GMT fallback: Unknown timezone → GMT+HH:MM
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Sruthy Jayan has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Removed the extra line from the testcase
>   
>   Signed-off-by: Sruthy Jayan <[email protected]>

Test changes look good to me. Left a couple of further comments.
@ArnoZeller, would you be able to confirm if this patch works on your AIX 
environment?

src/java.base/unix/native/libjava/TimeZone_md.c line 433:

> 431:      * This restriction has been removed from AIX7. */
> 432: 
> 433:     tz_buf = strdup(tz);

Could this allocation be NULL checked?

src/java.base/unix/native/libjava/TimeZone_md.c line 452:

> 450:         tz_len = (temp_tz == NULL) ? strlen(tz) : temp_tz - tz;
> 451:         free((void *) tz_buf);
> 452:         tz_buf = (char *)malloc(tz_len + 1);

Same here.

-------------

PR Review: https://git.openjdk.org/jdk/pull/31270#pullrequestreview-4430891257
PR Review Comment: https://git.openjdk.org/jdk/pull/31270#discussion_r3358421530
PR Review Comment: https://git.openjdk.org/jdk/pull/31270#discussion_r3358422449

Reply via email to