Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

parseUnifiedDiff exception on valid diff (Binary files) #182

Closed
@machadoit

Description

@machadoit

Describe the bug
com.github.difflib.unifieddiff.UnifiedDiffReader#parseUnifiedDiff fails when the diff contains changes with Binaries.

To Reproduce

  1. Consider a diff with Binary changes, like adding a new testproblem_diff_binary.diff with:
diff --git a/some-image.png b/some-image.pngnew file mode 100644index 0000000..bc3b5b4Binary files /dev/null and b/some-image.png differ
  1. Invokecom.github.difflib.unifieddiff.UnifiedDiffReader#parseUnifiedDiff like a new test:
    @Test    public void testParseBinary() throws IOException {        UnifiedDiff diff = UnifiedDiffReader.parseUnifiedDiff(                UnifiedDiffReaderTest.class.getResourceAsStream("problem_diff_binary.diff"));        assertEquals(1, 1);    }

By doing so, it returns an exception:

com.github.difflib.unifieddiff.UnifiedDiffReader processLine WARNING: >>> no rule matched Binary files /dev/null and b/some-image.png differ

Expected behavior
I would expect not to throw an exception, and that it would handle the Binary file entry as anUnifiedDiffFile

System
openjdk 17 2021-09-14
OpenJDK Runtime Environment Temurin-17+35 (build 17+35)
OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp