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
Fixing the null-unsafe bug in JsonPrinter #10365 #10366
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.
I didn't test this but the fix looks good.
📦 Pushed preview images as
🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name. |
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 don't think that can be it. Instead, I think the problem is that https://github.com/IQSS/dataverse/blame/6a26e6315834a7f26de2c00ec78df7752feccd5e/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java#L419 doesn't check for a null dsv. That's called by the new line at https://github.com/IQSS/dataverse/blame/6a26e6315834a7f26de2c00ec78df7752feccd5e/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java#L678. W.r.t. to the casting of the Null builder - the cast is just to an interface, there is no underlying class that has an add method, and we use this cast elsewhere w/o problem.
Hmm. The change above does fix it though.
note that it's not a dsv in the null exception, it's
i.e., it's
(and NullSafeJsonBuilder provides a |
(as always, corrected some typos in the last comment after the fact) |
Ah - I see. I was looking at the wrong version method. The interface doesn't have a method with Long, hence this issue. So it seems any of the calls in this whole class where a null Long after that cast would fail. As would any call with null values for int, double, boolean - as the NullSafeJsonBuilder doesn't have methods equivalent to the add Long method for Integer, Double, or Boolean? Is it worth fixing or noting these somewhere? |
I did notice that there were a few (but only a few) places in the class where NullSafeJsonBuilder was explicitly used in declarations. Could have been for this very reason? From a very quick look, it appears that in most places the notation
(these seem to be old, likely predating the NullSafeJsonBuilder class). |
Looks good. Verified that the problem is resolved when using DVUploader to call the API. |
Please note that I removed the milestone "6.1.1" and replaced it with "6.2". The definition of "6.1.1." was that it was something that needed to be included in the prod. patch of 6.1 deployed at IQSS, or in the 6.1 patch distributed to the community. I realized that this PR fixed something that was only broken in the develop branch - i.e., it was a new bug that was not in 6.1, so patching it there was not necessary. |
What this PR does / why we need it:
This was a simple bug in jsonprinter, recently merged (#10322). This is killing the
/addFiles
api that the Direct Upload and Globus apis rely on.Which issue(s) this PR closes:
Closes #10365
Special notes for your reviewer:
trivial?
Suggestions on how to test this:
As of now, an attempt to use DvUploader in direct upload mode is failing when used w/ the develop branch build, with the following error message:
Should be working again with this fix applied.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Is there a release notes update needed for this change?:
Additional documentation: