[Mercurial] IDEA-56080: Fixed NPE, removed unused methods.
authorKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Mon, 28 Jun 2010 14:18:43 +0000 (18:18 +0400)
committerKirill Likhodedov <kirill.likhodedov@jetbrains.com>
Mon, 28 Jun 2010 14:18:43 +0000 (18:18 +0400)
plugins/hg4idea/src/org/zmlx/hg4idea/command/HgCloneCommand.java
plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgCheckoutProvider.java

index cd26b3068705cac0edca82cf3e97581d5570cc4e..36c42f5a32cda5de957e07e637dadd02ebb0a49b 100644 (file)
@@ -1,6 +1,7 @@
 package org.zmlx.hg4idea.command;
 
 import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.Nullable;
 
 import java.nio.charset.Charset;
 import java.util.Collections;
@@ -17,27 +18,19 @@ public class HgCloneCommand {
     this.project = project;
   }
 
-  public String getDirectory() {
-    return directory;
-  }
-
   public void setDirectory(String directory) {
     this.directory = directory;
   }
 
-  public String getRepositoryURL() {
-    return repositoryURL;
-  }
-
   public void setRepositoryURL(String repositoryURL) {
     this.repositoryURL = repositoryURL;
   }
 
+  @Nullable
   public HgCommandResult execute() {
     List<String> arguments = new LinkedList<String>();
     arguments.add(repositoryURL);
     arguments.add(directory);
-
     return HgCommandService.getInstance(project).execute(null, Collections.<String>emptyList(), "clone", arguments, Charset.defaultCharset());
   }
 }
index 6b11878e98179d9ee631e6c3e9f279b3e0066611..5cbf9316167cb3a8e01655823153561c2f716c90 100644 (file)
@@ -38,9 +38,6 @@ public class HgCheckoutProvider implements CheckoutProvider {
 
   private HgCommandResult myCloneResult;
 
-  /**
-   * {@inheritDoc}
-   */
   public void doCheckout(@NotNull final Project project, @Nullable final Listener listener) {
     ApplicationManager.getApplication().runWriteAction(new Runnable() {
       public void run() {
@@ -69,15 +66,10 @@ public class HgCheckoutProvider implements CheckoutProvider {
       }
     }, HgVcsMessages.message("hg4idea.clone.progress", dialog.getSourceRepositoryURL()), false, project);
 
-    if (myCloneResult.getExitValue() == 0) {
-      if (listener != null) {
-        listener.directoryCheckedOut(new File(dialog.getParentDirectory(), dialog.getDirectoryName()));
-      }
-    }
-    if (listener != null) {
+    if (myCloneResult != null && myCloneResult.getExitValue() == 0 && listener != null) {
+      listener.directoryCheckedOut(new File(dialog.getParentDirectory(), dialog.getDirectoryName()));
       listener.checkoutCompleted();
     }
-
   }
 
   /**