Bug report
Required Info:
- Operating System:
- Installation type:
- Version or commit hash:
- ros-foxy-rclcpp/focal,now 2.4.0-1focal.20211014.182342 amd64
- DDS implementation:
- Client library (if applicable):
Steps to reproduce issue
Create a message type (StringLengthTest.msg) with size limited string field:
string<=10 size_limited_string
Publish a message with a lengthier string:
auto node = std::make_shared<rclcpp::Node>("string_length_test_publisher");
auto publisher = node->create_publisher<msg_tester_interfaces::msg::StringLengthTest>("oversized", 10);
auto message = msg_tester_interfaces::msg::StringLengthTest();
message.size_limited_string.resize(20, '.');
publisher->publish(message);
rclcpp::spin_some(node);
Expected behavior
Exception of type std::length_error.
Actual behavior
Message is published and received in full by an rclcpp subscriber, i.e., no error and no truncation.
Side note: an rclpy subscriber does throw an error:
AssertionError: The 'size_limited_string' field must be string value not longer than 10
Bug report
Required Info:
Steps to reproduce issue
Create a message type (
StringLengthTest.msg) with size limited string field:Publish a message with a lengthier string:
Expected behavior
Exception of type
std::length_error.Actual behavior
Message is published and received in full by an rclcpp subscriber, i.e., no error and no truncation.
Side note: an rclpy subscriber does throw an error: