void (@NotNull Url url, @NotNull File file, @NotNull DownloadingCallback callback, @Nullable Throwable startTrace) { LOG.debug("Downloading started: " + url); final String presentableUrl = StringUtil.trimMiddle(url.trimParameters().toDecodedForm(), 40); callback.setProgressText(IdeCoreBundle.message("download.progress.connecting", presentableUrl), true); try { connect(url, HttpRequests.request(url.toExternalForm()), request -> { int size = request.getConnection().getContentLength(); callback.setProgressText(IdeCoreBundle.message("download.progress.downloading", presentableUrl), size == -1); request.saveToFile(file, new AbstractProgressIndicatorExBase() { @Override public void setFraction(double fraction) { callback.setProgressFraction(0); } }); saveAdditionalData(request, file); FileType fileType = RemoteFileUtil.getFileType(request.getConnection().getContentType()); if (fileType == FileTypes.PLAIN_TEXT) { FileType fileTypeByFileName = FileTypeRegistry.getInstance().getFileTypeByFileName(PathUtilRt.getFileName(url.getPath())); if (fileTypeByFileName != FileTypes.UNKNOWN) { fileType = fileTypeByFileName; } } fileType = adjustFileType(fileType, url); LOG.debug("Downloading from " + url + " finished, " + size + " bytes downloaded"); if (startTrace != null) { LOG.debug("Start trace:", startTrace); } callback.finished(fileType); return null; }); } catch (IOException e) { LOG.info(e); callback.errorOccurred(IdeCoreBundle.message("cannot.load.remote.file", url, e.getMessage()), false); } }