diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisRepository.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisRepository.java index 0cc789ba8e13..70825a9b7266 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisRepository.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisRepository.java @@ -151,11 +151,12 @@ public class MantisRepository extends BaseRepositoryImpl { return new CancellableConnection() { @Override protected void doTest() throws Exception { + myProjects = null; try { createSoap().mc_enum_access_levels(getUsername(), getPassword()); } catch (Exception e) { - throw wrapException(e); + throw handleException(e); } } @@ -219,7 +220,7 @@ public class MantisRepository extends BaseRepositoryImpl { myProjects = projects; } - private static boolean checkAllProjectsAvailable(MantisConnectPortType soap) throws Exception { + private boolean checkAllProjectsAvailable(MantisConnectPortType soap) throws Exception { // Check whether All Projects is available supported by server try { String version = soap.mc_version(); @@ -230,12 +231,13 @@ public class MantisRepository extends BaseRepositoryImpl { return available; } catch (Exception e) { - throw wrapException(e); + throw handleException(e); } } - private static Exception wrapException(@NotNull Exception e) throws Exception { + private Exception handleException(@NotNull Exception e) throws Exception { if (e instanceof AxisFault) { + resetConfiguration(); throw new Exception(TaskBundle.message("failure.server.message", ((AxisFault)e).getFaultString()), e); } throw e; @@ -268,7 +270,7 @@ public class MantisRepository extends BaseRepositoryImpl { return soap.mc_issue_get(getUsername(), getPassword(), BigInteger.valueOf(Integer.valueOf(id))); } catch (RemoteException e) { - throw wrapException(e); + throw handleException(e); } } @@ -278,7 +280,7 @@ public class MantisRepository extends BaseRepositoryImpl { return soap.mc_projects_get_user_accessible(getUsername(), getPassword()); } catch (RemoteException e) { - throw wrapException(e); + throw handleException(e); } } @@ -288,7 +290,7 @@ public class MantisRepository extends BaseRepositoryImpl { return soap.mc_filter_get(getUsername(), getPassword(), BigInteger.valueOf(project.getId())); } catch (RemoteException e) { - throw wrapException(e); + throw handleException(e); } } @@ -308,10 +310,29 @@ public class MantisRepository extends BaseRepositoryImpl { } } catch (RemoteException e) { - throw wrapException(e); + throw handleException(e); } } + private void resetConfiguration() { + if (myProjects != null) { + for (MantisProject project : myProjects) { + if (project.isUnspecified()) { + myCurrentProject = project; + for (MantisFilter filter : project.getFilters()) { + if (filter.isUnspecified()) { + myCurrentFilter = filter; + break; + } + } + break; + } + } + } else { + myCurrentProject = null; + myCurrentFilter = null; + } + } @Nullable public MantisProject getCurrentProject() { diff --git a/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisRepositoryEditor.java b/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisRepositoryEditor.java index 2fa02e5f178d..c34006e949a6 100644 --- a/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisRepositoryEditor.java +++ b/plugins/tasks/tasks-core/src/com/intellij/tasks/mantis/MantisRepositoryEditor.java @@ -36,7 +36,7 @@ import java.util.List; /** * @author Mikhail Golubev * @author evgeny.zakrevsky - * Date: 9/21/12 + * Date: 9/21/12 */ public class MantisRepositoryEditor extends BaseRepositoryEditor { private ComboBox myProjectCombobox; @@ -105,6 +105,10 @@ public class MantisRepositoryEditor extends BaseRepositoryEditor