-
-
Notifications
You must be signed in to change notification settings - Fork 196
UnifiedDiffParserException on apparently sane file (2nd variant) #107
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
Comments
That is a nice huge diff. The new implementation of java-diff-utils will gain a lot of testing on this large file base. I will look into it. |
Thanks a lot @wumpz! I might have other cases as well for you later, as I plan to test each and every patch from CentOS and likely other open source projects as well 😉 |
To somehow document this: https://stackoverflow.com/questions/5813311/no-newline-at-end-of-file. This weird \ No newline at end of file is put into a diff by Git to signal, that there is no linefeed at the end of the last line of this diff. |
So my implementation stores this as a flag within UnifiedDiffFile, so the write can write those lines without putting a linefeed at the end. I hope that is right. |
Just deployed a new version. |
@wumpz I am still getting the same exact error when I try to parse this patch from this JIRA ticket. |
@elanzini I will look into it. |
@elanzini May I include this patch as test data into java-diff-utils? I already solved the problem and would like to use your test data. |
@wumpz by all means! And thanks for the quick fix! I will open new issues as I find more edge cases where it breaks. |
@wumpz I found other examples for this problem pgjdbc/pgjdbc@cdeeaca or apache/cxf@1cf4fed. For both, if you try to parse the diff, you get the same complaint |
@elanzini I included all three of your tests. They are now succeeding. |
same problem here :) |
Still no valid date there, since I wanted to include the new implementation of meyers linear space diff algorithm. |
Describe the bug
UnifiedDiffReader.parseUnifiedDiff
throws UnifiedDiffParserException on a patch which apparently looks good:https://raw.githubusercontent.com/bazelbuild/bazel/master/third_party/aws-sdk-auth-lite/patches-vs-1.11.297/01-bazel-strip-unused.patch
To Reproduce
Run this program:
Expected behavior
No Exceptions.
Actual behavior
Dec 14, 2020 9:49:46 PM com.github.difflib.unifieddiff.UnifiedDiffReader processLine
WARNING: >>> no rule matched \ No newline at end of file
Exception in thread "main" com.github.difflib.unifieddiff.UnifiedDiffParserException: expected file start line not found
at com.github.difflib.unifieddiff.UnifiedDiffReader.parse(UnifiedDiffReader.java:95)
at com.github.difflib.unifieddiff.UnifiedDiffReader.parseUnifiedDiff(UnifiedDiffReader.java:146)
...
System
Notes
👋 java-diff-utils maintainers again! Here is another corner case I found. The patch comes from the Bazel project, so once again it's OK to include in tests.
The text was updated successfully, but these errors were encountered: