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

Temporary fix for TimeSyncMessage invalid json serialization #563

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

paulbourelly999
Copy link
Contributor

PR Details

Description

Temporary fix for TMX Message invalid JSON serialization (See Issue #561). Fix uses regex to filter out quotations from json string for attributes that are bool, numeric or null.

Related Issue

Motivation and Context

Maintain simulation time synchronization functionality of V2X-Hub/CARMA-Streets

How Has This Been Tested?

Tested in local dev container environment.

Types of changes

  • Defect fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that cause existing functionality to change)

Checklist:

  • I have added any new packages to the sonar-scanner.properties file
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
    V2XHUB Contributing Guide
  • I have added tests to cover my changes.
  • All new and existing tests passed.

// is currently out of scope. TMX Messages should be correctly serialize to
// and from json. This temporary fix simply using regex to look for numeric,
// null, and bool values and removes the quotations around them.
boost::regex exp("\"(null|true|false|[0-9]+(\\.[0-9]+)?)\"");
Copy link
Collaborator

@willjohnsonk willjohnsonk Sep 8, 2023

Choose a reason for hiding this comment

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

I know this is just a quick fix, but could this potentially cast numeric-only hex values differently than those with letters? If that is how they're passed via json in the existing code at least. Not sure if many, if any, fields will be affected either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently this is only being called on a single message, the TimeSyncMessage with two attributes seq and timestep, both are numeric. I do not think we need any protection against hex strings represented in json here.

@willjohnsonk willjohnsonk marked this pull request as ready for review September 8, 2023 20:46
@willjohnsonk willjohnsonk merged commit a8c58fe into develop Sep 8, 2023
7 of 8 checks passed
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.

2 participants