From b412f2e296a76ccd7db7ffa7226dac95180583e3 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Fri, 24 Oct 2014 13:39:21 +0200 Subject: [PATCH] CR-IC-6500#c33030 add missed nullability annotations --- .../intellij/ide/plugins/RepositoryHelper.java | 2 +- .../updateSettings/impl/PluginDownloader.java | 18 +++++++++--------- .../updateSettings/impl/UpdateChecker.java | 2 +- .../intellij/util/io/UrlConnectionUtil.java | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/RepositoryHelper.java b/platform/platform-impl/src/com/intellij/ide/plugins/RepositoryHelper.java index 09132fb032ac..64bb3e8c88e4 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/RepositoryHelper.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/RepositoryHelper.java @@ -164,7 +164,7 @@ public class RepositoryHelper { } private synchronized static List readPluginsStream(@NotNull URLConnection connection, - ProgressIndicator indicator, + @Nullable ProgressIndicator indicator, @NotNull String file) throws Exception { File localFile; InputStream input = getConnectionInputStream(connection); diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginDownloader.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginDownloader.java index 2d1069e26eb1..f5f9429b8cf5 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginDownloader.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/PluginDownloader.java @@ -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(); diff --git a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java index f72fed2b53fc..6e879427859a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java +++ b/platform/platform-impl/src/com/intellij/openapi/updateSettings/impl/UpdateChecker.java @@ -273,7 +273,7 @@ public final class UpdateChecker { Map downloaded, Collection 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; diff --git a/platform/platform-impl/src/com/intellij/util/io/UrlConnectionUtil.java b/platform/platform-impl/src/com/intellij/util/io/UrlConnectionUtil.java index 198ead74eeec..3b1e7049942d 100644 --- a/platform/platform-impl/src/com/intellij/util/io/UrlConnectionUtil.java +++ b/platform/platform-impl/src/com/intellij/util/io/UrlConnectionUtil.java @@ -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); }