-
Notifications
You must be signed in to change notification settings - Fork 499
Fix the jackson issue when parsing a maven settings file #6543
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
base: main
Are you sure you want to change the base?
Conversation
|
I was able to reproduce the new error. but well using the Rewrite XML parser config |
...rc/test/java/org/openrewrite/maven/MavenSettingsWithServerHttpHeaderParsedByJacksonTest.java
Outdated
Show resolved
Hide resolved
|
We can fix the issue reported part of this PR if we change from "false" to "true" the value of the StacktTrace |
|
There is still an issue as this test fails as the html generated dont include We got instead of |
|
I created a simple jackson project to reproduce the issue: https://github.com/ch007m/maven-settings-httpheader-issue/ |
| public class MavenSettings { | ||
| @Nullable | ||
| String localRepository; | ||
| public String localRepository; |
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 it absolutely necessary to make these fields public?
I'd prefer not to expose these fields to recipe authors directly.
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.
Fixed with a488b96
| public class MavenSettings { | ||
| @Nullable | ||
| String localRepository; | ||
| private String localRepository; |
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.
Originally we had these without a modifier, instead relying on @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
| private String localRepository; | |
| String localRepository; |
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.
It is still there within the header class definition
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
@ToString(onlyExplicitlyIncluded = true)
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@Data
@AllArgsConstructor
@JacksonXmlRootElement(localName = "settings")
public class MavenSettings {
…onfiguration./httpHeaders element. openrewrite#4803 Signed-off-by: Charles Moulliard <[email protected]>
…sWithServerHttpHeaderParsedByJacksonTest.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…settings.xml parsed is null using ObjectMapper code of rewrite-maven Signed-off-by: Charles Moulliard <[email protected]> # Conflicts: # rewrite-maven/src/test/java/org/openrewrite/maven/MavenSettingsWithServerHttpHeaderParsedByJacksonTest.java
…lse to true the value of the .defaultUseWrapper(true) of the XmlMapper.Builder value of the .defaultUseWrapper(true) of the XmlMapper.Builder Signed-off-by: Charles Moulliard <[email protected]>
…rror: no String-argument constructor/factory method to deserialize from String Signed-off-by: Charles Moulliard <[email protected]>
…Failed to read /var/temp/xxx/settings.xml Signed-off-by: Charles Moulliard <[email protected]>
…ize or deserialize serverconfigurayion with Timeout or HttpHeaders by removing lombok and using plain java code Signed-off-by: Charles Moulliard <[email protected]>
Signed-off-by: Charles Moulliard <[email protected]>
Signed-off-by: Charles Moulliard <[email protected]>
Signed-off-by: Charles Moulliard <[email protected]>
e7b38a2 to
9624492
Compare
What's changed?
I included part of the MavenSettings and RawRepositories java classes the missing constructors required by jackson when we bump jackson from 2.17 to >= 2.19 to avoid the deserialization issue with HttpHeader and Property
The MavenSettingsTest is again failing but not because there is deserialization issue using
2.17or2.20but instead because we got a null HttpHeader object vs X-JFrog-Art-Api when rewrite is processing it !!Hopefully, the following TestCase where we only use jackson works with
2.17or2.20Checklist