From 5b9c94fa3ea2428b3cea4ce8680b03d037d8955d Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Mon, 2 Oct 2017 16:24:52 +0300 Subject: [PATCH] PY-26298 EA-107209 Return empty list in case of exception instead of null It's not the best idea to suppress exceptions (logged) like that, but PyPackageManager itself works this way at the moment by caching an empty list of packages after the first error. It also releases the clients of refreshAndGetPackages() of burden of handling these (presumably rare) exceptions on their own. --- python/src/com/jetbrains/python/packaging/PyPackageUtil.java | 1 + 1 file changed, 1 insertion(+) diff --git a/python/src/com/jetbrains/python/packaging/PyPackageUtil.java b/python/src/com/jetbrains/python/packaging/PyPackageUtil.java index 4f0864a26443..25bbc64564e8 100644 --- a/python/src/com/jetbrains/python/packaging/PyPackageUtil.java +++ b/python/src/com/jetbrains/python/packaging/PyPackageUtil.java @@ -308,6 +308,7 @@ public class PyPackageUtil { packagesRef.set(manager.refreshAndGetPackages(false)); } catch (ExecutionException e) { + packagesRef.set(Collections.emptyList()); if (LOG.isDebugEnabled()) { e.initCause(callStacktrace); LOG.debug(e);