Skip to content

[WIP] Removes JodaTime - #157

Closed
bakatz wants to merge 10 commits into
jasync-sql:masterfrom
bakatz:master
Closed

bakatz wants to merge 10 commits into
jasync-sql:masterfrom
bakatz:master

Conversation

@bakatz

@bakatz bakatz commented Sep 30, 2019 •

Copy link
Copy Markdown

I don't want a dependency on JodaTime for my projects, so I decided to start fixing #131

TODO:
[x] Common library
[x] MySQL
[x] Fix TimestampEncoder
[ ] Fix MySQL tests
[] Postgres
[] Fix Postgres tests

Looking for comments on this before I finish the whole thing (ideally from someone who has in depth knowledge of java.time) - I'm not 100% sure I've converted the calls successfully in some cases. Mostly followed this as a guide: https://blog.joda.org/2014/11/converting-from-joda-time-to-javatime.html

Implementation notes:
TimestampEncoder is definitely broken, probably need to use ZonedDateTime instead of LocalDateTime etc. Will take a look at it later and resolve. Even though TimestampEncoder assumes no time zone, it formats times using a 'Z' suffix to represent the UTC timezone. As such, I had to make it use ZonedDateTime otherwise a formatting exception would occur at runtime.

Cheers

@oshai

oshai commented Sep 30, 2019

Copy link
Copy Markdown
Contributor

Thanks for the effort! I guess you saw conversation in #131
In any case a suggestion for competability or migration for users will be also beneficial.

@bakatz

bakatz commented Sep 30, 2019

Copy link
Copy Markdown
Author

@oshai No worries! Yep, I saw the discussion. In the event that I get this working I'll bump the version to 2.0.0 since this would be a breaking change. Will add some notes to the README as well in that case RE: how to migrate from 1.x to 2.x.

@@ -1,18 +1,10 @@
package com.github.jasync.sql.db.column

import sun.net.util.IPAddressUtil.textToNumericFormatV4

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not compiling for me using JDK 11 (AdoptOpenJDK, windows), and generally using sun.* packages is discouraged - decided to replace with standard java library calls. Let me know if there's a reason this textToNumeric() call was made in the first place - seems like .getByName() works OK

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I checked it and this method not exists in java 8

@bakatz bakatz Sep 30, 2019 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, the textToNumeric methods aren't public/don't exist or something. That's why I decided to remove them.

@bakatz

bakatz commented Oct 8, 2019

Copy link
Copy Markdown
Author

hey @oshai I made some progress and fixed all of the common tests. However, I'm running into a strange exception with the MySQL tests. It seems one test is failing due to:

com.github.jasync.sql.db.mysql.PreparedStatementsSpec > read a timestamp with microseconds FAILED
    java.util.concurrent.ExecutionException at PreparedStatementsSpec.kt:277
        Caused by: java.lang.UnsupportedOperationException

Does this sound familiar to you? I haven't been able to figure out what's causing it.

Thanks

@oshai

oshai commented Oct 8, 2019

Copy link
Copy Markdown
Contributor

Try to run the test seperatly and provide full stacktrace. Right now it doesn't looks familiar.

@oshai

oshai commented Dec 22, 2019

Copy link
Copy Markdown
Contributor

@bakatz - whats the status of this PR? are you still planning on working on it?

@bakatz

bakatz commented Dec 22, 2019

Copy link
Copy Markdown
Author

@oshai not exactly - haven't had time to work on this due to work commitments - feel free to take the PR over if you have time

@oshai

oshai commented Dec 22, 2019

Copy link
Copy Markdown
Contributor

@bakatz I don't have the time to do that as well, just thinking how we can continue that effort.

@github-actions

Copy link
Copy Markdown

Stale pull request message

@github-actions github-actions Bot closed this May 21, 2020
@oshai oshai mentioned this pull request Sep 6, 2020
@oshai oshai mentioned this pull request May 30, 2021
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants