Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

UnifiedDiffParserException on apparently sane file (2nd variant) #107

Copy link
Copy link

Description

@moio
Issue body actions

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:

String patch = new Scanner(new URL(
    "https://raw.githubusercontent.com/bazelbuild/bazel/master/third_party/aws-sdk-auth-lite/patches-vs-1.11.297/01-bazel-strip-unused.patch"
).openStream(), "UTF-8").useDelimiter("\\A").next();

UnifiedDiffReader.parseUnifiedDiff(new StringBufferInputStream(patch));

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

  • Java version: openjdk-11
  • Version: 4.9

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.