Title: parseUnifiedDiff exception on valid diff (Binary files) · Issue #182 · java-diff-utils/java-diff-utils · GitHub
Open Graph Title: parseUnifiedDiff exception on valid diff (Binary files) · Issue #182 · java-diff-utils/java-diff-utils
X Title: parseUnifiedDiff exception on valid diff (Binary files) · Issue #182 · java-diff-utils/java-diff-utils
Description: Describe the bug com.github.difflib.unifieddiff.UnifiedDiffReader#parseUnifiedDiff fails when the diff contains changes with Binaries. To Reproduce Consider a diff with Binary changes, like adding a new test problem_diff_binary.diff with...
Open Graph Description: Describe the bug com.github.difflib.unifieddiff.UnifiedDiffReader#parseUnifiedDiff fails when the diff contains changes with Binaries. To Reproduce Consider a diff with Binary changes, like adding ...
X Description: Describe the bug com.github.difflib.unifieddiff.UnifiedDiffReader#parseUnifiedDiff fails when the diff contains changes with Binaries. To Reproduce Consider a diff with Binary changes, like adding ...
Opengraph URL: https://github.com/java-diff-utils/java-diff-utils/issues/182
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"parseUnifiedDiff exception on valid diff (Binary files)","articleBody":"**Describe the bug**\r\n`com.github.difflib.unifieddiff.UnifiedDiffReader#parseUnifiedDiff` fails when the diff contains changes with Binaries.\r\n\r\n**To Reproduce**\r\n\r\n1. Consider a diff with Binary changes, like adding a new test `problem_diff_binary.diff` with:\r\n```\r\ndiff --git a/some-image.png b/some-image.png\r\nnew file mode 100644\r\nindex 0000000..bc3b5b4\r\nBinary files /dev/null and b/some-image.png differ\r\n```\r\n\r\n2. Invoke `com.github.difflib.unifieddiff.UnifiedDiffReader#parseUnifiedDiff` like a new test:\r\n\r\n```\r\n @Test\r\n public void testParseBinary() throws IOException {\r\n UnifiedDiff diff = UnifiedDiffReader.parseUnifiedDiff(\r\n UnifiedDiffReaderTest.class.getResourceAsStream(\"problem_diff_binary.diff\"));\r\n\r\n assertEquals(1, 1);\r\n }\r\n```\r\n\r\nBy doing so, it returns an exception:\r\n\r\n```\r\ncom.github.difflib.unifieddiff.UnifiedDiffReader processLine WARNING: \u003e\u003e\u003e no rule matched Binary files /dev/null and b/some-image.png differ\r\n```\r\n\r\n\r\n**Expected behavior**\r\nI would expect not to throw an exception, and that it would handle the Binary file entry as an `UnifiedDiffFile`\r\n\r\n**System**\r\nopenjdk 17 2021-09-14\r\nOpenJDK Runtime Environment Temurin-17+35 (build 17+35)\r\nOpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing)","author":{"url":"https://github.com/machadoit","@type":"Person","name":"machadoit"},"datePublished":"2024-02-06T17:55:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/182/java-diff-utils/issues/182"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6338b7ef-b0ee-6449-6301-b484d9da3f53 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AC52:1A4860:27DF636:37912D9:69694E8C |
| html-safe-nonce | 51c6f04aecf4373d47a8562fa739892221f18aa2cb735539bc5f20672e7f8f7d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQzUyOjFBNDg2MDoyN0RGNjM2OjM3OTEyRDk6Njk2OTRFOEMiLCJ2aXNpdG9yX2lkIjoiODAxMDAyNzU5NDA2NjUxMzU0OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7a95e3e67105c41ed1fed05e7a9bb04c181baece38bdd3927fc223f7fe71c98d |
| hovercard-subject-tag | issue:2121379309 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/java-diff-utils/java-diff-utils/182/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cf71f7c736471dc581ce81ad040e71107675fe22e662fbab415cb15b36f60cf2/java-diff-utils/java-diff-utils/issues/182 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cf71f7c736471dc581ce81ad040e71107675fe22e662fbab415cb15b36f60cf2/java-diff-utils/java-diff-utils/issues/182 |
| og:image:alt | Describe the bug com.github.difflib.unifieddiff.UnifiedDiffReader#parseUnifiedDiff fails when the diff contains changes with Binaries. To Reproduce Consider a diff with Binary changes, like adding ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | machadoit |
| hostname | github.com |
| expected-hostname | github.com |
| None | 54182691a21263b584d2e600b758e081b0ff1d10ffc0d2eefa51cf754b43b51d |
| turbo-cache-control | no-preview |
| go-import | github.com/java-diff-utils/java-diff-utils git https://github.com/java-diff-utils/java-diff-utils.git |
| octolytics-dimension-user_id | 40540835 |
| octolytics-dimension-user_login | java-diff-utils |
| octolytics-dimension-repository_id | 86663812 |
| octolytics-dimension-repository_nwo | java-diff-utils/java-diff-utils |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 86663812 |
| octolytics-dimension-repository_network_root_nwo | java-diff-utils/java-diff-utils |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d69ac0477df0f87da03b8b06cebd187012d7a930 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width