Skip to content
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 additional check for non-manadatory parameters #2538

Merged

Conversation

ZhdanovP
Copy link
Contributor

@ZhdanovP ZhdanovP commented Aug 27, 2018

Fixes #2443

This PR is ready for review.

Risk

This PR makes no API changes.

Testing Plan

ATF script - smartdevicelink/sdl_atf_test_scripts#2020

Summary

The OnPutFile notification has non mandatory parameters
fileSize and length. If the mobile application has no provided
appropriate parameters SDL sends fileSize: null as json value to HMI.

The commit fixes the issue and simply remove non mandatory parameter in
case mobile app sends nothing for one.

Tasks Remaining:

  • fix implementation
  • atf script

CLA

message[strings::msg_params][strings::file_size] =
(*message_)[strings::msg_params][strings::length];
if ((*message_)[strings::msg_params].keyExists(strings::offset)) {
message[strings::msg_params][strings::offset] = offset_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment is redundant, the same assignment is two lines above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jacobkeeler Yes, good point, please take a look b4691c7

message[strings::msg_params][strings::offset] = offset_;
if (0 == offset_ && (*message_)[strings::msg_params].keyExists(strings::length)) {
message[strings::msg_params][strings::file_size] =
(*message_)[strings::msg_params][strings::length];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong case, this should be set to length_ if 0 == offset_ && !keyExists(strings::length), file_size should not be set if length is sent by the app. This is because if length is provided or offset is nonzero, it means that this is a partial data chunk, which means that you cannot determine the length of the file.

    message[strings::msg_params][strings::offset] = offset_;
    if (0 == offset_ && !(*message_)[strings::msg_params].keyExists(strings::length)) {
      message[strings::msg_params][strings::file_size] = length_;
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jacobkeeler please take a look b4691c7

The OnPutFile notification has non mandatory parameters
`fileSize` and `length`. If the mobile application has no provided
appropriate parameters SDL sends `fileSize`: null as json value to HMI.

The commit fixes the issue and simply remove non mandatory parameter in
case mobile app sends nothing for one.
@jacobkeeler jacobkeeler merged commit 9dd604a into develop Sep 4, 2018
@jacobkeeler
Copy link
Contributor

@ZhdanovP I needed to revert your changes since you still have not signed the CLA (despite checking the box). You will need to reopen a new PR for this change. Please sign the CLA before doing so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants