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: handling null 'from' parameter #632

Merged
merged 2 commits into from
Oct 3, 2022
Merged

fix: handling null 'from' parameter #632

merged 2 commits into from
Oct 3, 2022

Conversation

isha689
Copy link
Contributor

@isha689 isha689 commented Sep 20, 2022

Fixes

Resolved Issue as part of this PR.
Serialization was failing when 'from' parameter was null, so added a check to handle the null values.
Solution is referenced from here

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the main branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

If you have questions, please file a support ticket, or create a GitHub Issue in this repository.

@sbansla
Copy link
Contributor

sbansla commented Sep 26, 2022

Changes looks good to me.

@@ -17,7 +17,9 @@ public class PhoneNumberConverter : JsonConverter
/// <param name="serializer">unsued</param>
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var t = JToken.FromObject(value.ToString());
var t = value.ToString() != null
Copy link
Contributor

Choose a reason for hiding this comment

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

When this line is called, is object null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Object is not null here, but value.ToString() is null, as ToString() method is overriden.
Discussed here previously.

@sonarcloud
Copy link

sonarcloud bot commented Oct 3, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@sbansla sbansla merged commit 4941d45 into main Oct 3, 2022
@sbansla sbansla deleted the resolving-issue-539 branch October 3, 2022 06:08
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.

Serializing MessageResource response object using Newtonsoft throws error
3 participants