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

Fix enum sequence and struct sequence validation #412

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jonathan-r-thorpe
Copy link
Contributor

  • Enum sequences and struct sequences are failing the constraint validation even though they were valid.
  • This is because the enum and struct sequences were not being treated like arrays.
  • This PR fixes the problem.
  • It also includes improved logging/error reporting.
  • The draft MS-05-02 test suite in NMOS Testing has been updated to trap this bug.

Copy link
Contributor

@lo-simon lo-simon left a comment

Choose a reason for hiding this comment

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

Suggest minor changes. Rest LGTM.

@@ -30,6 +30,7 @@ namespace nmos
// unknown property
utility::stringstream_t ss;
ss << U("unknown property: ") << property_id.serialize() << U(" to do Get");
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
slog::log<slog::severities::error>(gate, SLOG_FLF) << ss.str();

return details::make_nc_method_result({ nc_method_status::parameter_error });
utility::stringstream_t ss;
ss << "Set property: " << property_id.serialize() << " value: " << val.serialize() << " error: " << e.what();
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
slog::log<slog::severities::error>(gate, SLOG_FLF) << ss.str();

}
}

// unknown property
utility::stringstream_t ss;
ss << U("unknown property: ") << property_id.serialize() << " to do Set";
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
slog::log<slog::severities::error>(gate, SLOG_FLF) << ss.str();

@@ -126,12 +129,14 @@ namespace nmos
// out of bound
utility::stringstream_t ss;
ss << U("property: ") << property_id.serialize() << U(" is outside the available range to do GetSequenceItem");
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
slog::log<slog::severities::error>(gate, SLOG_FLF) << ss.str();

return details::make_nc_method_result_error({ nc_method_status::index_out_of_bounds }, ss.str());
}

// unknown property
utility::stringstream_t ss;
ss << U("unknown property: ") << property_id.serialize() << U(" to do GetSequenceItem");
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
slog::log<slog::severities::error>(gate, SLOG_FLF) << ss.str();

@@ -368,6 +383,7 @@ namespace nmos
// null
utility::stringstream_t ss;
ss << U("property: ") << property_id.serialize() << " is a null sequence to do GetSequenceLength";
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
slog::log<slog::severities::error>(gate, SLOG_FLF) << ss.str();

@@ -377,6 +393,7 @@ namespace nmos
// unknown property
utility::stringstream_t ss;
ss << U("unknown property: ") << property_id.serialize() << " to do GetSequenceLength";
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
slog::log<slog::severities::error>(gate, SLOG_FLF) << ss.str();

@@ -444,13 +461,17 @@ namespace nmos
// no role
utility::stringstream_t ss;
ss << U("role: ") << role.as_string() << U(" not found to do FindMembersByPath");
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
slog::log<slog::severities::error>(gate, SLOG_FLF) << ss.str();

return details::make_nc_method_result_error({ nc_method_status::parameter_error }, U("no members to do FindMembersByPath"));
utility::stringstream_t ss;
ss << U("role: ") << role.as_string() << U(" has no members to do FindMembersByPath");
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
slog::log<slog::severities::error>(gate, SLOG_FLF) << utility::conversions::to_utf8string(ss.str());
slog::log<slog::severities::error>(gate, SLOG_FLF) << ss.str();

@@ -2,6 +2,7 @@

#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/find.hpp>
#include <boost/algorithm/string/split.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#include <boost/algorithm/string/split.hpp>

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.

3 participants