-
Notifications
You must be signed in to change notification settings - Fork 34
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
oem-ibm: Handle the json parse exception correctly #621
Conversation
f0df9cc
to
dd2c4fb
Compare
if (dataNew.is_discarded()) | ||
try | ||
{ | ||
dataNew = Json::parse(jsonFileNew); |
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.
define dataNew here itself? auto dataNew
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.
We need to use this dataNew after try-catch, so can't use auto here
{ | ||
error("Failed to parse the new license json file '{NEW_LIC_JSON}'", | ||
"NEW_LIC_JSON", newLicJsonFilePath); | ||
throw InternalFailure(); | ||
return PLDM_ERROR; |
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.
return PLDM_ERROR_INVALID_DATA ?
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.
Done
if (dataNew.is_discarded()) | ||
try | ||
{ | ||
dataNew = Json::parse(jsonFileNew); |
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.
Jay, no need of other two parameters? (nullptr and false)
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.
Not needed as they are the default args with values as nullptr and true. In fact the intention is to change the third argument to true which matches with default value.
dd2c4fb
to
7d0c250
Compare
jenkins run tests please |
info("Setting Pending Attributes {NUMBER}", "NUMBER", | ||
(int)pendingAttributes.size()); |
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't we print the attribute names here ? size might not give much clues if we hit this path.
7d0c250
to
a5254e8
Compare
This commit handles the CoD license json parsing exception by correctly catching it and returns the error to the caller. Also made the change to avoid the removal of license json file whenever shared by the host. Tested: Done the sanity testing to verify that json file was kept without removal. Signed-off-by: Jayashankar Padath <[email protected]>
a5254e8
to
266ad67
Compare
This commit handles the CoD license json parsing exception by correctly catching it and returns the error to the caller. Also made the change to avoid the removal of license json file whenever shared by the host. Tested: Done the sanity testing to verify that json file was kept without removal. Signed-off-by: Jayashankar Padath <[email protected]>
This commit handles the CoD license json parsing exception by correctly catching it and returs the error to the caller. Also made the change to avoid the removal of license json file whenever shared by the host.
Tested:
Done the sanity testing to verify that json file was kept without removal.