-
Notifications
You must be signed in to change notification settings - Fork 3
Address Comments from #49: Improve Logging and JSON Handling #52
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
Address Comments from #49: Improve Logging and JSON Handling #52
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self-review
| 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; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: These methods were not used
| } | ||
| } | ||
| // System.out.println(metaDataNode); | ||
| log.trace("MetaDataNode: {}", metaDataNode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: This was a commented out System.out print and has been changed to a TRACE level log.
payneBrandon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
This PR addresses comments on #49.
Summary of Changes
Testing