Exception using CvsServices in custom plugin

I am writing a pluging for IntelliJ, depending on CVS Support. I wanted to checkout some files from an arbitrary CVS Configuration. Especially, this could be another configuration then the default one controlling the project sources.
In my custom action, I am going to open a dialog, collect some file and cvs repository data and try to do this when hitting "ok":

    final CvsServices cvsServices = CvsServices.getInstance();
    final CvsRepository[] configuredRepositories = cvsServices.getConfiguredRepositories(); // result should be 2 repositories for me
The result is this exception:

[ 912286]  ERROR - com.intellij.ide.IdeEventQueue - Error during dispatching of java.awt.event.MouseEvent[MOUSE_RELEASED,(561,402),absolute(695,533),button=1,modifiers=Button1,clickCount=1] on dialog7
at com.intellij.cvsSupport2.config.CvsRootConfiguration.createCvsRepository(CvsRootConfiguration.java:247)
at com.intellij.cvsSupport2.impl.CvsServicesImpl.getConfiguredRepositories(CvsServicesImpl.java:80)
at de.company.intellij.plugin.CVSWorker.checkOutFile(CVSWorker.java:73)
... (more stacktrace) ...
[ 912288]  ERROR - com.intellij.ide.IdeEventQueue - IntelliJ IDEA 9.0.3  Build #IC-90.SNAPSHOT
[ 912288]  ERROR - com.intellij.ide.IdeEventQueue - JDK: 1.6.0_15
[ 912288]  ERROR - com.intellij.ide.IdeEventQueue - VM: Java HotSpot(TM) 64-Bit Server VM
[ 912288]  ERROR - com.intellij.ide.IdeEventQueue - Vendor: Apple Inc.
[ 912288]  ERROR - com.intellij.ide.IdeEventQueue - OS: Mac OS X
[ 912288]  ERROR - com.intellij.ide.IdeEventQueue - Last Action: CheckoutSingleFilePopup
CvsApplicationLevelConfiguration.getInstance().CONFIGURATIONS works and shows me the two configured environments, but createCvsRepository fails, because settings.METHOD is null.

I found these two issues probably relating the same behaviour:

This one is pretty old(!)...

This one say it happens with no root cvs configured...

This is kind of strange, especially the pretty old and reopened issue.

I guess this is a bug and I tried this fix which works for me:
The RootFormatter#createConfiguration (IDEARootFormatter#createSettings) creates a Settings-Object, depending on the root.METHOD but leaving the Sessings.METHOD empty.
Filling in the root.METHOD (which was successfully determined as pserver) did it for me. I am not sure if the Formatter should pass the root.METHOD or if the Session-Object can set it's METHOD to the corresponding (e.g. CvsMethod.PSERVER_METHOD) default static value. The first solution appears to be more defensive but probably it is just the same.

Am I missing something important? Am I calling the methods in an improper way or state? Or is this a bug?



Please sign in to leave a comment.