-
Notifications
You must be signed in to change notification settings - Fork 36
Closed
Labels
type: bugSomething isn't workingSomething isn't working
Milestone
Description
Bug Report
I'm using the latest driver 0.8.6.
I have a field in an MSSQLServer table that is of the DateTimeOffSet type, and I realized that when the timezone is negative it ignores the signal and treats it as a positive timezone.
Analyzing the code of the OffsetDateTimeCodec Class, in line 87 we have a call to the uShort method of the Decode class, which converts the buffer to an unsigned integer.
int localMinutesOffset = Decode.uShort (buffer);
This removes the TimeZone signal when it is negative. The correct thing would be to do this:
int localMinutesOffset = Decode.Short (buffer);
As the Short method does not exist in the Decode class, it would be necessary to add it to this class, as in the example below:
public static int Short (ByteBuf buffer) {
return buffer.readShortLE ();
}
With this simple change, the negative and positive timezones will be decoded correctly.
Metadata
Metadata
Assignees
Labels
type: bugSomething isn't workingSomething isn't working
Type
Projects
Relationships
Development
Select code repository
Activity
mp911de commentedon Jul 19, 2021
Are you interested in providing a pull request that contains the fix and a way to reproduce the issue?
italiviocorrea commentedon Jul 19, 2021
Hey! I can make the correction yes, it's up to you. Even because I made a fork and I'm using it with the fix, so far this solution is ok. I'm not practice pull request, but I'm a fast learner and I have a lot of experience in java programming, suddenly I can help fix other bugs. And I'm already using the lib in one project, which I'm currently working on, and I plan to use it in other projects.
[-]Problem with negative Timezone in column of type DateTimeZoneOffSet[/-][+]`OffsetDateTimeCodec` does not properly decode negative timezone offsets[/+]Fix negative timezone offset parsing.