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

Null-safe diff #27

Closed
GoogleCodeExporter opened this issue Jul 15, 2015 · 2 comments
Closed

Null-safe diff #27

GoogleCodeExporter opened this issue Jul 15, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link
Contributor

diff_main accepts two Strings as arguments. When one of them is null, diff_main 
fails with a NullPointerException.

How about making it null-pointer safe, like the apache-commons StringUtils?

Patch is attached

Original issue reported on code.google.com by Sven.Lil...@gmail.com on 10 Jun 2010 at 7:39

Attachments:

@GoogleCodeExporter
Copy link
Contributor Author

Original comment by neil.fra...@gmail.com on 10 Jun 2010 at 11:47

  • Changed state: Started

@GoogleCodeExporter
Copy link
Contributor Author

After reviewing this issue internally we came to the decision that the opposite 
behaviour is preferable.  Passing a null could be the result of an error 
somewhere upstream, so it is safer to throw an error immediately than to 
quietly interpret the null as an empty string.  Accordingly all versions of DMP 
have been changed to throw an error if null is passed to any of the three main 
functions: diff_main, match_main and patch_make.

Previously, some languages (e.g. C++) would automatically do the null to string 
conversion, whereas others (e.g. Java) would throw an error at some random call 
deep within the code.  Now all languages throw an error immediately.

I'm sorry this isn't the behaviour you had asked for.  But we do think the 
resulting safety is worth the two-line wrapper you'll need to replace nulls 
with empty strings before calling DMP.

Original comment by neil.fra...@gmail.com on 21 Jun 2010 at 9:59

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant