Title: UnifiedDiffParserException: expected file start line not found · Issue #98 · java-diff-utils/java-diff-utils · GitHub
Open Graph Title: UnifiedDiffParserException: expected file start line not found · Issue #98 · java-diff-utils/java-diff-utils
X Title: UnifiedDiffParserException: expected file start line not found · Issue #98 · java-diff-utils/java-diff-utils
Description: Describe the bug I try to parse a patch-file, generated from git git format-patch -1
Open Graph Description: Describe the bug I try to parse a patch-file, generated from git git format-patch -1
X Description: Describe the bug I try to parse a patch-file, generated from git git format-patch -1 <commit>, with content: From fd940c6f66126734e82c00889e7c987e11deea91 Mon Sep 17 00:00:00 2001 From: Tomas...
Opengraph URL: https://github.com/java-diff-utils/java-diff-utils/issues/98
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"UnifiedDiffParserException: expected file start line not found","articleBody":"**Describe the bug**\r\n\r\nI try to parse a patch-file, generated from git `git format-patch -1 \u003ccommit\u003e`, with content:\r\n\r\n```\r\nFrom fd940c6f66126734e82c00889e7c987e11deea91 Mon Sep 17 00:00:00 2001\r\nFrom: Tomas Bjerre \u003ctomas.bjerre85@gmail.com\u003e\r\nDate: Sun, 6 Sep 2020 11:20:34 +0200\r\nSubject: [PATCH] removing file\r\n\r\n---\r\n .../violations/lib/model/ViolationTest.java | 37 -------------------\r\n 1 file changed, 37 deletions(-)\r\n delete mode 100644 src/test/java/se/bjurr/violations/lib/model/ViolationTest.java\r\n\r\ndiff --git a/src/test/java/se/bjurr/violations/lib/model/ViolationTest.java b/src/test/java/se/bjurr/violations/lib/model/ViolationTest.java\r\ndeleted file mode 100644\r\nindex 3e40b52..0000000\r\n--- a/src/test/java/se/bjurr/violations/lib/model/ViolationTest.java\r\n+++ /dev/null\r\n@@ -1,37 +0,0 @@\r\n-package se.bjurr.violations.lib.model;\r\n-\r\n-import static org.assertj.core.api.Assertions.assertThat;\r\n-import static se.bjurr.violations.lib.model.SEVERITY.ERROR;\r\n-import static se.bjurr.violations.lib.model.Violation.violationBuilder;\r\n-import static se.bjurr.violations.lib.reports.Parser.CHECKSTYLE;\r\n-\r\n-import org.junit.Test;\r\n-import se.bjurr.violations.lib.model.Violation.ViolationBuilder;\r\n-import uk.co.jemos.podam.api.PodamFactoryImpl;\r\n-\r\n-public class ViolationTest {\r\n-\r\n- @Test\r\n- public void testThatFilePathsAreAlwaysFronSlashes() {\r\n- final Violation violation =\r\n- violationBuilder() //\r\n- .setParser(CHECKSTYLE) //\r\n- .setFile(\"c:\\\\path\\\\to\\\\file.xml\") //\r\n- .setMessage(\"message\") //\r\n- .setSeverity(ERROR) //\r\n- .setStartLine(1) //\r\n- .build();\r\n- assertThat(violation.getFile()) //\r\n- .isEqualTo(\"c:/path/to/file.xml\");\r\n- }\r\n-\r\n- @Test\r\n- public void testThatCopyConstructorWorks() {\r\n- final ViolationBuilder originalBuilder =\r\n- new PodamFactoryImpl().manufacturePojo(ViolationBuilder.class);\r\n- final Violation original = originalBuilder.build();\r\n- final Violation copied = new Violation(original);\r\n- assertThat(copied) //\r\n- .isEqualTo(original);\r\n- }\r\n-}\r\n-- \r\n2.25.1\r\n\r\n\r\n```\r\n\r\nI get error like:\r\n\r\n```\r\ncom.github.difflib.unifieddiff.UnifiedDiffParserException: expected file start line not found\r\n\tat com.github.difflib.unifieddiff.UnifiedDiffReader.parse(UnifiedDiffReader.java:93)\r\n\tat com.github.difflib.unifieddiff.UnifiedDiffReader.parseUnifiedDiff(UnifiedDiffReader.java:144)\r\n```\r\n\r\n**To Reproduce**\r\n\r\nParse above data with:\r\n\r\n```\r\n InputStream reportContentStream = new ByteArrayInputStream(reportContent.getBytes(UTF_8));\r\n UnifiedDiff parsedDiff = UnifiedDiffReader.parseUnifiedDiff(reportContentStream);\r\n```\r\n\r\n**Expected behavior**\r\nNot to crash\r\n\r\n**System**\r\n - Java version 1.8.0_171\r\n - Version 4.8-SNAPSHOT de04bd688a0ee067fbe9bbc6344b1ceedfd6e220\r\n\r\nRelates to https://github.com/tomasbjerre/violations-lib/issues/95","author":{"url":"https://github.com/tomasbjerre","@type":"Person","name":"tomasbjerre"},"datePublished":"2020-09-06T10:15:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/98/java-diff-utils/issues/98"}
| 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:5575dbb7-f004-86ce-7385-7e1b946f11cf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D1F4:256A62:1B0319:247093:6969CF7D |
| html-safe-nonce | b068db3dd8308cef86059e36826a84d96bc2a57fbee13f086f088116e2efd5e9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUY0OjI1NkE2MjoxQjAzMTk6MjQ3MDkzOjY5NjlDRjdEIiwidmlzaXRvcl9pZCI6IjU4MzAwMDk4MzA3OTIzNTE2MTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 238bf4bd6509b9f73f9d75c790e98e5fe391fb135ef192fbe5cd9a95795400de |
| hovercard-subject-tag | issue:694323571 |
| 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/98/issue_layout |
| twitter:image | https://opengraph.githubassets.com/00838d93aa06fe355a214ea51620d019828e423134465d9f70f9b2589bcb1d23/java-diff-utils/java-diff-utils/issues/98 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/00838d93aa06fe355a214ea51620d019828e423134465d9f70f9b2589bcb1d23/java-diff-utils/java-diff-utils/issues/98 |
| og:image:alt | Describe the bug I try to parse a patch-file, generated from git git format-patch -1 |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tomasbjerre |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| 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 | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width