mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CR-IC-6500#c33030 add missed nullability annotations
This commit is contained in:
@@ -164,7 +164,7 @@ public class RepositoryHelper {
|
||||
}
|
||||
|
||||
private synchronized static List<IdeaPluginDescriptor> readPluginsStream(@NotNull URLConnection connection,
|
||||
ProgressIndicator indicator,
|
||||
@Nullable ProgressIndicator indicator,
|
||||
@NotNull String file) throws Exception {
|
||||
File localFile;
|
||||
InputStream input = getConnectionInputStream(connection);
|
||||
|
||||
+9
-9
@@ -98,7 +98,7 @@ public class PluginDownloader {
|
||||
return prepareToInstall(pi, myBuildNumber);
|
||||
}
|
||||
|
||||
public boolean prepareToInstall(@Nullable ProgressIndicator pi, @Nullable BuildNumber forBuildNumber) throws IOException {
|
||||
public boolean prepareToInstall(@Nullable ProgressIndicator progressIndicator, @Nullable BuildNumber forBuildNumber) throws IOException {
|
||||
if (myFile != null) {
|
||||
return true;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public class PluginDownloader {
|
||||
// download plugin
|
||||
String errorMessage = IdeBundle.message("unknown.error");
|
||||
try {
|
||||
myFile = downloadPlugin(pi);
|
||||
myFile = downloadPlugin(progressIndicator);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
myFile = null;
|
||||
@@ -236,15 +236,15 @@ public class PluginDownloader {
|
||||
}
|
||||
}
|
||||
|
||||
private File downloadPlugin(@Nullable final ProgressIndicator pi) throws IOException {
|
||||
private File downloadPlugin(@Nullable final ProgressIndicator progressIndicator) throws IOException {
|
||||
final File pluginsTemp = new File(PathManager.getPluginTempPath());
|
||||
if (!pluginsTemp.exists() && !pluginsTemp.mkdirs()) {
|
||||
throw new IOException(IdeBundle.message("error.cannot.create.temp.dir", pluginsTemp));
|
||||
}
|
||||
final File file = FileUtil.createTempFile(pluginsTemp, "plugin_", "_download", true, false);
|
||||
|
||||
if (pi != null) {
|
||||
pi.setText(IdeBundle.message("progress.connecting"));
|
||||
if (progressIndicator != null) {
|
||||
progressIndicator.setText(IdeBundle.message("progress.connecting"));
|
||||
}
|
||||
|
||||
URLConnection connection = null;
|
||||
@@ -252,19 +252,19 @@ public class PluginDownloader {
|
||||
connection = openConnection(myPluginUrl);
|
||||
|
||||
final InputStream is = (ApplicationManager.getApplication() != null)
|
||||
? UrlConnectionUtil.getConnectionInputStream(connection, pi)
|
||||
? UrlConnectionUtil.getConnectionInputStream(connection, progressIndicator)
|
||||
: connection.getInputStream();
|
||||
if (is == null) {
|
||||
throw new IOException("Failed to open connection");
|
||||
}
|
||||
|
||||
if (ApplicationManager.getApplication() != null && pi != null) {
|
||||
pi.setText(IdeBundle.message("progress.downloading.plugin", getPluginName()));
|
||||
if (progressIndicator != null && ApplicationManager.getApplication() != null) {
|
||||
progressIndicator.setText(IdeBundle.message("progress.downloading.plugin", getPluginName()));
|
||||
}
|
||||
try {
|
||||
final OutputStream fos = new BufferedOutputStream(new FileOutputStream(file, false));
|
||||
try {
|
||||
NetUtils.copyStreamContent(pi, is, fos, connection.getContentLength());
|
||||
NetUtils.copyStreamContent(progressIndicator, is, fos, connection.getContentLength());
|
||||
}
|
||||
finally {
|
||||
fos.close();
|
||||
|
||||
+1
-1
@@ -273,7 +273,7 @@ public final class UpdateChecker {
|
||||
Map<PluginId, PluginDownloader> downloaded,
|
||||
Collection<IdeaPluginDescriptor> incompatiblePlugins,
|
||||
boolean collectToUpdate,
|
||||
ProgressIndicator indicator) throws IOException {
|
||||
@Nullable ProgressIndicator indicator) throws IOException {
|
||||
final String pluginId = downloader.getPluginId();
|
||||
final String pluginVersion = downloader.getPluginVersion();
|
||||
if (collectToUpdate && PluginManagerCore.getDisabledPlugins().contains(pluginId)) return;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class UrlConnectionUtil {
|
||||
|
||||
public static
|
||||
@Nullable
|
||||
InputStream getConnectionInputStream(URLConnection connection, ProgressIndicator pi) {
|
||||
InputStream getConnectionInputStream(URLConnection connection, @Nullable ProgressIndicator pi) {
|
||||
try {
|
||||
return getConnectionInputStreamWithException(connection, pi);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user