PY-20081 Fix AssertionError in PyPIPackageUtil#fillPackageDetails() when there are...
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Thu, 14 Jul 2016 19:23:29 +0000 (22:23 +0300)
committerAndrey Vlasovskikh <andrey.vlasovskikh@jetbrains.com>
Fri, 15 Jul 2016 14:12:13 +0000 (17:12 +0300)
python/src/com/jetbrains/python/packaging/PyPIPackageUtil.java

index aed7ec0b80a39e31c7167f2a5d442de46e9ca9cd..3f43a07ae282d5bfbf3bc7c6a9d45bdd04e92b89 100644 (file)
@@ -194,8 +194,8 @@ public class PyPIPackageUtil {
           }
         }
       }
-      catch (Exception ignored) {
-        LOG.info(ignored);
+      catch (Exception e) {
+        callback.handleError(e, null, "");
       }
     });
   }
@@ -204,22 +204,27 @@ public class PyPIPackageUtil {
     ourPackageToReleases.put(packageName, releases);
   }
 
-  public void usePackageReleases(@NotNull @NonNls String packageName, @NotNull AsyncCallback callback) {
-    try {
-      final List<String> releases = getPackageVersionsFromAdditionalRepositories(packageName);
-      if (releases == null) {
-        final Vector<String> params = new Vector<>();
-        params.add(packageName);
-        params.add("show_hidden=True");
-        myXmlRpcClient.executeAsync("package_releases", params, callback);
+  public void usePackageReleases(@NotNull String packageName, @NotNull AsyncCallback callback) {
+    ApplicationManager.getApplication().executeOnPooledThread(() -> {
+      try {
+        final List<String> releases = getPackageVersionsFromAdditionalRepositories(packageName);
+        if (releases == null) {
+          final Vector<String> params = new Vector<>();
+          params.add(packageName);
+          params.add("show_hidden=True");
+          final Object result = myXmlRpcClient.execute("package_releases", params);
+          if (result != null) {
+            callback.handleResult(result, null, "");
+          }
+        }
+        else {
+          callback.handleResult(releases, null, "");
+        }
       }
-      else {
-        callback.handleResult(releases, null, "");
+      catch (Exception e) {
+        callback.handleError(e, null, "");
       }
-    }
-    catch (IOException e) {
-      callback.handleError(e, null, "");
-    }
+    });
   }
 
   @Nullable