Projects tigase _server tigase-utils Issues #16
Why we have class tigase.util.datetime.TimestampHelper ? (#16)
Closed
Bartosz Małkowski opened 6 years ago

Why you created class tigase.util.datetime.TimestampHelper instead of use (and extend?) tigase.util.datetime.DateTimeFormatter?

Because of this, I cannot join to MUC room from Swift because it uses more detailed timestamps: 2018-08-21T08:48:22.792921Z and this format is not supported by helper.

Here is test for that.

	@Test
	public void testParsingWithMsLong() throws ParseException {
		Date result = helper.parseTimestamp("2018-08-21T08:48:22.792921Z");
		long milis = 1534841302792l;
		Date date = new Date(milis);
		assertEquals(date, result);
	}

Andrzej Wójcik (Tigase) commented 6 years ago

‚TimestampHelper’ class was created while I was working on MessageArchiving support and was part of MA jar. Later on, as I was working on better support for time zone handling I’ve discovered that ‘DateTimeFormatter’ was not properly handling this information, so I’ve decided to replace it with ‘TimestampHelper’ which was handling different time zone correctly.

To be hosnest usage of so long milliseconds part is weird for me and I’ve never tested support for that. Even databases on our schemes are keeping only milliseconds precision (3 positions after the seconds part).

Best it would be to modify ‘TimestampHelper’ to correctly handle that. However, code in ‘DateTimeHelper’ was not very readable and not handling time zones correctly, so we should add it as a special case to what ‘TimezoneHelper’ does right now.

I can handle it next week if it can wait. If so, then please reassign this issue back to me.

Bartosz Małkowski commented 6 years ago

If you don't like DateTimeFormatter, we can switch to TimestampHelper but I think we should pick one of them and remove the second one. It can wait. For now I used DateTimeFormatter in MUC to fix problem.

I have no idea why they use so big precision. But I think we should be able to parse it. Of course we still can create three digits ms part in our code.

Bartosz Małkowski commented 6 years ago

I reimplemented Helper, added tests. Old DateTimeFormatter is marked as deprecated.

Andrzej Wójcik (Tigase) commented 6 years ago

I've reviewed changes and they look ok, however now TTS-NG returns a lot of errors. I've created task #8103 to review results and fix those issues so that I could confirm that this change has no negative impact on the rest the server.

Andrzej Wójcik (Tigase) commented 6 years ago

Now it looks that TTS-NG is not returning any errors after applying a fix in Jaxmpp2 timestamp parsing. Closing issue.

issue 1 of 1
Type
Task
Priority
Major
Assignee
RedmineID
8092
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/tigase-utils#16
Please wait...
Page is in error, reload to recover