Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughFixes timezone name-key generation by using Rule.formatName(...) when compiling zones so setFixedSavings() receives a formatted name instead of raw Changes
Sequence Diagram(s)sequenceDiagram
participant C as ZoneInfoCompiler
participant Z as Zone
participant R as Rule
participant B as DateTimeZoneBuilder
participant RS as RuleSet
C->>Z: read zone (iFormat, iOffsetMillis, iRules)
alt iRules == null
C->>R: Rule.formatName(iFormat, iOffsetMillis, 0, null)
R-->>C: formattedName
C->>B: setFixedSavings(formattedName, offset, 0)
else iRules references RuleSet
C->>RS: parseTime(iRules) / lookup
RS-->>C: saveMillis (or throws)
C->>R: Rule.formatName(iFormat, iOffsetMillis, saveMillis, null)
R-->>C: formattedName
C->>B: setFixedSavings(formattedName, offset, saveMillis) or rs.addRecurring(...)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the time zone format code '%z' was incorrectly used as a literal zone name instead of being formatted as an offset. The fix applies Rule.formatName() to properly convert format codes like '%z', '/', and '%s' into their actual representations before passing them to the builder.
Changes:
- Modified
ZoneInfoCompiler.javato callRule.formatName()before setting fixed savings - Added test case for Dubai timezone which uses '%z' format
- Added test data structure for Asia/Dubai transitions
- Updated changes.xml with fix description
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/java/org/joda/time/tz/ZoneInfoCompiler.java | Added calls to Rule.formatName() to format zone names before passing to builder |
| src/test/java/org/joda/time/tz/TestCompiler.java | Added Dubai test case and test data constant |
| src/test/java/org/joda/time/tz/TestBuilder.java | Added ASIA_DUBAI_DATA test data structure |
| src/changes/changes.xml | Documented the fix in version 2.14.1 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The code '%z' is used as a name key in certain simple cases It had been mapped to a zone offset in some, but not all, circumstances Fixes #800
501d3c8 to
8e8424e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/main/java/org/joda/time/tz/ZoneInfoCompiler.java`:
- Around line 1064-1068: In ZoneInfoCompiler's numeric-rules branch, the
formattedName is built with Rule.formatName(zone.iFormat, zone.iOffsetMillis, 0,
null) which passes 0 for the savings and causes %z/STD-DST formatting to be
incorrect; change the call to use the parsed saveMillis from
parseTime(zone.iRules) (i.e., Rule.formatName(zone.iFormat, zone.iOffsetMillis,
saveMillis, null)) before calling builder.setFixedSavings(formattedName,
saveMillis) so the name key reflects the actual fixed saving.
### What changes were proposed in this pull request? This PR upgrades `joda-time` to `2.14.1`. ### Why are the changes needed? To bring in the latest upstream bug fixes and keep the dependency up to date. - https://www.joda.org/joda-time/changes-report.html#a2.14.1 - https://github.com/JodaOrg/joda-time/releases/tag/v2.14.1 - JodaOrg/joda-time#827 - JodaOrg/joda-time#829 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (claude-opus-4-6) Closes #55293 from dongjoon-hyun/SPARK-56439. Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: Cheng Pan <chengpan@apache.org>
The code '%z' is used as a time zone name key in certain simple cases It had been mapped to a zone offset in some, but not all, circumstances.
Fixes #800
Summary by CodeRabbit
Release Notes
Bug Fixes
Updates
Tests
✏️ Tip: You can customize this high-level summary in your review settings.