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
Add support for SnakeYaml to be able to parse timestamps correctly when timezone is set or not #5626
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you point out what part of this class is different from the class it is extending?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, the updated/added parts from the original code are these two if blocks:
if (timezoneh_s != null) {
String time = timezonem_s != null ? ":" + timezonem_s : "00";
timeZone = TimeZone.getTimeZone("GMT" + timezoneh_s + time);
calendar = Calendar.getInstance(timeZone);
;
} else {
calendar = Calendar.getInstance();
}
and
if (timeZone == null) {
return new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime());
} else {
return calendar.getTime();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a change that would be beneficial to make to SnakeYaml itself? I think that if possible, that would be more preferable. I am concerned that as the SnakeYaml class we're extending changes, we won't get the changes ourselves because we override so much of that class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Steve, do you mean we should create an issue or request the SnakeYaml team to make this change we have done here? I think it's true if they make any sort of change to the ConstructYamlTimestamp
we won't get it as we override it, although I'm not sure if that could be any time soon. If you guys agree I can create an issue for this change on their end, but let's move ahead with this change and once they fix it on their end we can revert this change. How does it sound to you?
cc: @filipelautert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable. I was suggesting that we make a PR on their repo, not an issue, since we know what the change should be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not able to create a PR on their repo, but I created this issue for them with the proposed changes we added in this PR. In the meantime, as mentioned above I think we can move forward with this PR and revert these changes once they apply the fix for it (if they do).
Thanks,
Daniel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Daniel!!
liquibase-standard/src/main/java/liquibase/parser/core/yaml/CustomConstructYamlTimestamp.java
Dismissed
Show resolved
Hide resolved
liquibase-standard/src/main/java/liquibase/parser/core/yaml/CustomConstructYamlTimestamp.java
Dismissed
Show dismissed
Hide dismissed
liquibase-standard/src/main/java/liquibase/parser/core/yaml/CustomConstructYamlTimestamp.java
Dismissed
Show dismissed
Hide dismissed
liquibase-standard/src/main/java/liquibase/parser/core/yaml/CustomConstructYamlTimestamp.java
Dismissed
Show dismissed
Hide dismissed
liquibase-standard/src/main/java/liquibase/parser/core/yaml/CustomConstructYamlTimestamp.java
Dismissed
Show dismissed
Hide dismissed
liquibase-standard/src/main/java/liquibase/parser/core/yaml/CustomConstructYamlTimestamp.java
Dismissed
Show dismissed
Hide dismissed
liquibase-standard/src/main/java/liquibase/parser/core/yaml/CustomConstructYamlTimestamp.java
Dismissed
Show dismissed
Hide dismissed
liquibase-standard/src/main/java/liquibase/parser/core/yaml/CustomConstructYamlTimestamp.java
Dismissed
Show dismissed
Hide dismissed
liquibase-standard/src/main/java/liquibase/parser/core/yaml/CustomConstructYamlTimestamp.java
Dismissed
Show dismissed
Hide dismissed
liquibase-standard/src/main/java/liquibase/parser/core/yaml/CustomConstructYamlTimestamp.java
Dismissed
Show resolved
Hide resolved
Hey @filipelautert, This is pretty much all snakeyaml code. I don't think it's worth spending time on it, since we are going to revert/update this code soon (when they get their code updated). Thanks, |
… timezones. - Tests added.
1f5770f
to
aafdb2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test failure is expected and will be fixed after sync with master. Tested manually, LGTM
Impact
Description
A new ConstructYamlTimestamp class was created to identify whether a date time should be returned with the timezone included or not.
Fixes #5499
Things to be aware of
Things to worry about
Additional Context
N/A