PatchReader (@NotNull VirtualFile patchFile) { try { String text = ReadAction.compute(() -> { try (InputStreamReader inputStreamReader = new InputStreamReader(patchFile.getInputStream(), patchFile.getCharset())) { return StreamUtil.readText(inputStreamReader); } }); PatchReader reader = new PatchReader(text); reader.parseAllPatches(); return reader; } catch (Exception e) { addNotificationAndWarn(VcsBundle.message("patch.apply.cannot.read.patch", patchFile.getPresentableName(), e.getMessage())); return null; } }