Address Comments from #49: Improve Logging and JSON Handling#52
Merged
payneBrandon merged 10 commits intorelease/v2.0from Apr 18, 2025
Merged
Address Comments from #49: Improve Logging and JSON Handling#52payneBrandon merged 10 commits intorelease/v2.0from
payneBrandon merged 10 commits intorelease/v2.0from
Conversation
…when converting TMC TIM
…in item when converting TMC TIM
Added a fallback mechanism in JsonToJavaConverter to handle cases where frameType is not present in the TravelerDataFrame during the conversion process. A warning is logged, and the frameType defaults to 'advisory' to ensure proper handling and avoid potential null values.
Removed `convertJ2735SpecialVehicleExtensionsJsonToJava` and `convertJ2735SupplementalVehicleExtensionsJsonToJava` methods, as well as their associated imports.
Marking the ObjectMapper as final ensures its immutability and prevents accidental reassignment. This change improves code stability and readability, aligning with best practices.
Moved mock OdeTravelerInformationMessage JSON content to an external file for better readability and maintainability. Updated test methods and helper functions to read the JSON data from the new file, ensuring consistency and reducing code duplication. Adjusted method signatures to handle IOException as needed.
Updated `docker-compose.yml` to use the `ACM_LOG_LEVEL` value from the `.env` file for better configurability. Added `ACM_LOG_LEVEL` to `sample.env` with a default value of `ERROR`.
dmccoystephenson
commented
Apr 9, 2025
Comment on lines
-51
to
-80
| public J2735SpecialVehicleExtensions convertJ2735SpecialVehicleExtensionsJsonToJava(String value, int i) { | ||
|
|
||
| JsonNode part2Node = getPart2Node(value, i); | ||
| J2735SpecialVehicleExtensions spve = null; | ||
| try { | ||
| spve = mapper.treeToValue(part2Node, J2735SpecialVehicleExtensions.class); | ||
| } catch (JsonProcessingException e) { | ||
| e.printStackTrace(); | ||
| } | ||
| return spve; | ||
| } | ||
|
|
||
| public J2735SupplementalVehicleExtensions convertJ2735SupplementalVehicleExtensionsJsonToJava(String value, int i) { | ||
|
|
||
| JsonNode part2Node = getPart2Node(value, i); | ||
| J2735SupplementalVehicleExtensions suve = null; | ||
| try { | ||
| suve = mapper.treeToValue(part2Node, J2735SupplementalVehicleExtensions.class); | ||
| } catch (JsonProcessingException e) { | ||
| e.printStackTrace(); | ||
| } | ||
| return suve; | ||
| } | ||
|
|
||
| public JsonNode getPart2Node(String value, int i) { | ||
| JsonNode part2 = JsonUtils.getJsonNode(value, "payload").get("data").get("partII"); | ||
| if (part2 != null) | ||
| return part2.get(i).get("value"); | ||
| return null; | ||
| } |
Member
Author
There was a problem hiding this comment.
Note: These methods were not used
| } | ||
| } | ||
| // System.out.println(metaDataNode); | ||
| log.trace("MetaDataNode: {}", metaDataNode); |
Member
Author
There was a problem hiding this comment.
Note: This was a commented out System.out print and has been changed to a TRACE level log.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses comments on #49.
Summary of Changes
Testing