Attachment (@NotNull String path, @NotNull VirtualFile file) { try (InputStream inputStream = file.getInputStream()) { return com.intellij.openapi.diagnostic.AttachmentFactory.createAttachment(path, inputStream, file.getLength(), file.getFileType().isBinary()); } catch (IOException e) { LOG.warn("failed to create an attachment from " + file.getPath(), e); return new Attachment(file.getPath(), e); } }