Skip to content

[WIP] Removes JodaTime #157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed

[WIP] Removes JodaTime #157

wants to merge 10 commits into from

Conversation

bakatz
Copy link

@bakatz bakatz commented Sep 30, 2019

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
Copy link
Contributor

oshai commented Sep 30, 2019

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
Copy link
Author

bakatz commented Sep 30, 2019

@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
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
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

Copy link
Author

@bakatz bakatz Sep 30, 2019

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
Copy link
Author

bakatz commented Oct 8, 2019

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
Copy link
Contributor

oshai commented Oct 8, 2019

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

@oshai
Copy link
Contributor

oshai commented Dec 22, 2019

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

@bakatz
Copy link
Author

bakatz commented Dec 22, 2019

@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
Copy link
Contributor

oshai commented Dec 22, 2019

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

@github-actions
Copy link

Stale pull request message

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