From 5bdbe01df7ce6b20da1c485d55115ea46e216eaf Mon Sep 17 00:00:00 2001 From: i053322 Date: Tue, 9 Aug 2016 22:23:27 +0300 Subject: [PATCH] Add support for checkout exception Change-Id: Ib41bc35dd6395656f9d7a9cccf0886e809e8dc5f Signed-off-by: i053322 --- .../che/git/impl/jgit/JGitConfigImpl.java | 2 +- .../che/git/impl/jgit/JGitConnection.java | 20 +++- .../git/impl/jgit/JGitConnectionFactory.java | 2 +- .../che/git/impl/jgit/JGitStatusImpl.java | 2 +- .../che/git/impl/jgit/ssh/SshKeyProvider.java | 2 +- .../git/impl/nativegit/CommandProcess.java | 2 +- .../che/git/impl/nativegit/ConfigImpl.java | 2 +- .../git/impl/nativegit/GitAskPassScript.java | 2 +- .../che/git/impl/nativegit/NativeGit.java | 2 +- .../impl/nativegit/NativeGitConnection.java | 4 +- .../nativegit/NativeGitConnectionFactory.java | 3 +- .../git/impl/nativegit/NativeGitDiffPage.java | 2 +- .../impl/nativegit/NativeGitStatusImpl.java | 2 +- .../impl/nativegit/commands/AddCommand.java | 2 +- .../commands/BranchCreateCommand.java | 2 +- .../commands/BranchDeleteCommand.java | 2 +- .../nativegit/commands/BranchListCommand.java | 2 +- .../commands/BranchRenameCommand.java | 2 +- .../nativegit/commands/CheckoutCommand.java | 2 +- .../impl/nativegit/commands/CloneCommand.java | 2 +- .../nativegit/commands/CommitCommand.java | 4 +- .../impl/nativegit/commands/DiffCommand.java | 2 +- .../nativegit/commands/EmptyGitCommand.java | 2 +- .../impl/nativegit/commands/FetchCommand.java | 2 +- .../nativegit/commands/GetConfigCommand.java | 2 +- .../impl/nativegit/commands/GitCommand.java | 2 +- .../impl/nativegit/commands/InitCommand.java | 2 +- .../nativegit/commands/ListFilesCommand.java | 2 +- .../impl/nativegit/commands/LogCommand.java | 2 +- .../nativegit/commands/LsRemoteCommand.java | 2 +- .../impl/nativegit/commands/MergeCommand.java | 2 +- .../impl/nativegit/commands/MoveCommand.java | 2 +- .../impl/nativegit/commands/PullCommand.java | 2 +- .../impl/nativegit/commands/PushCommand.java | 2 +- .../nativegit/commands/RemoteAddCommand.java | 2 +- .../commands/RemoteDeleteCommand.java | 2 +- .../nativegit/commands/RemoteListCommand.java | 2 +- .../commands/RemoteOperationCommand.java | 2 +- .../commands/RemoteUpdateCommand.java | 2 +- .../nativegit/commands/RemoveCommand.java | 2 +- .../impl/nativegit/commands/ResetCommand.java | 2 +- .../nativegit/commands/SetConfigCommand.java | 2 +- .../nativegit/commands/StatusCommand.java | 2 +- .../nativegit/commands/TagCreateCommand.java | 4 +- .../nativegit/commands/TagDeleteCommand.java | 2 +- .../nativegit/commands/TagListCommand.java | 2 +- .../git/impl/nativegit/ssh/GitSshScript.java | 2 +- .../nativegit/ssh/GitSshScriptProvider.java | 2 +- .../impl/nativegit/ssh/SshKeyProvider.java | 2 +- .../impl/nativegit/ssh/UnixGitSshScript.java | 2 +- .../nativegit/ssh/WindowsGitSshScript.java | 2 +- .../impl/GitConnectionFactoryProvider.java | 4 +- .../nativegit/NativeGitConnectionTest.java | 2 +- .../nativegit/ssh/SshScriptProviderTest.java | 2 +- .../java/org/eclipse/che/api/git/Config.java | 2 + .../che/api/git/CredentialsLoader.java | 1 + .../che/api/git/CredentialsProvider.java | 1 + .../eclipse/che/api/git/GitConnection.java | 1 + .../che/api/git/GitConnectionFactory.java | 1 + .../che/api/git/GitExceptionMapper.java | 64 +++++++++++++ .../org/eclipse/che/api/git/GitModule.java | 1 + .../che/api/git/GitProjectImporter.java | 5 +- .../org/eclipse/che/api/git/GitService.java | 1 + .../git/exception/GitConflictException.java | 92 +++++++++++++++++++ .../api/git/{ => exception}/GitException.java | 2 +- .../exception/GitInvalidRefNameException.java | 49 ++++++++++ .../GitRefAlreadyExistsException.java | 49 ++++++++++ .../exception/GitRefNotFoundException.java | 49 ++++++++++ .../git/shared/ConflictExceptionError.java | 58 ++++++++++++ .../eclipse/che/api/git/GitServiceTest.java | 1 + .../org/eclipse/che/git/impl/AddTest.java | 2 +- .../che/git/impl/BranchCreateTest.java | 2 +- .../che/git/impl/BranchDeleteTest.java | 2 +- .../eclipse/che/git/impl/CheckoutTest.java | 3 +- .../org/eclipse/che/git/impl/CommitTest.java | 2 +- .../org/eclipse/che/git/impl/ConfigTest.java | 2 +- .../org/eclipse/che/git/impl/DiffTest.java | 2 +- .../org/eclipse/che/git/impl/FetchTest.java | 2 +- .../che/git/impl/GetCommitersTest.java | 2 +- .../org/eclipse/che/git/impl/GitTestUtil.java | 2 +- .../org/eclipse/che/git/impl/InitTest.java | 2 +- .../eclipse/che/git/impl/LsRemoteTest.java | 2 +- .../org/eclipse/che/git/impl/PullTest.java | 2 +- .../org/eclipse/che/git/impl/PushTest.java | 2 +- .../eclipse/che/git/impl/RemoteAddTest.java | 2 +- .../che/git/impl/RemoteDeleteTest.java | 2 +- .../che/git/impl/RemoteUpdateTest.java | 2 +- .../org/eclipse/che/git/impl/RemoveTest.java | 2 +- .../eclipse/che/git/impl/TagCreateTest.java | 2 +- .../eclipse/che/git/impl/TagDeleteTest.java | 2 +- .../org/eclipse/che/git/impl/TagListTest.java | 2 +- 91 files changed, 464 insertions(+), 91 deletions(-) create mode 100644 platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitExceptionMapper.java create mode 100644 platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitConflictException.java rename platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/{ => exception}/GitException.java (95%) create mode 100644 platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitInvalidRefNameException.java create mode 100644 platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitRefAlreadyExistsException.java create mode 100644 platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitRefNotFoundException.java create mode 100644 platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/shared/ConflictExceptionError.java diff --git a/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitConfigImpl.java b/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitConfigImpl.java index 3cffea052..24f35c058 100644 --- a/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitConfigImpl.java +++ b/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitConfigImpl.java @@ -12,7 +12,7 @@ package org.eclipse.che.git.impl.jgit; import org.eclipse.che.api.git.Config; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.StoredConfig; diff --git a/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitConnection.java b/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitConnection.java index a273d01b0..5e7c3f2e1 100644 --- a/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitConnection.java +++ b/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitConnection.java @@ -26,7 +26,11 @@ import org.eclipse.che.api.git.CredentialsLoader; import org.eclipse.che.api.git.DiffPage; import org.eclipse.che.api.git.GitConnection; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; +import org.eclipse.che.api.git.exception.GitConflictException; +import org.eclipse.che.api.git.exception.GitRefAlreadyExistsException; +import org.eclipse.che.api.git.exception.GitRefNotFoundException; +import org.eclipse.che.api.git.exception.GitInvalidRefNameException; import org.eclipse.che.api.git.GitUrlUtils; import org.eclipse.che.api.git.LogPage; import org.eclipse.che.api.git.UserCredential; @@ -92,6 +96,9 @@ import org.eclipse.jgit.api.TransportCommand; import org.eclipse.jgit.api.TransportConfigCallback; import org.eclipse.jgit.api.errors.CheckoutConflictException; +import org.eclipse.jgit.api.errors.RefAlreadyExistsException; +import org.eclipse.jgit.api.errors.InvalidRefNameException; +import org.eclipse.jgit.api.errors.RefNotFoundException; import org.eclipse.jgit.api.errors.DetachedHeadException; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.TransportException; @@ -153,6 +160,7 @@ import java.util.stream.Collectors; import static com.google.common.base.Strings.isNullOrEmpty; +import static java.lang.String.format; import static java.lang.System.lineSeparator; import static java.nio.file.attribute.PosixFilePermission.OWNER_READ; import static java.nio.file.attribute.PosixFilePermission.OWNER_WRITE; @@ -316,9 +324,17 @@ public void checkout(CheckoutRequest request) throws GitException { } try { checkoutCommand.call(); + } catch(CheckoutConflictException exception){ + throw new GitConflictException(exception.getMessage(), exception.getConflictingPaths()); + } catch(RefAlreadyExistsException exception){ + throw new GitRefAlreadyExistsException(exception.getMessage()); + } catch(RefNotFoundException exception){ + throw new GitRefNotFoundException(exception.getMessage()); + } catch(InvalidRefNameException exception){ + throw new GitInvalidRefNameException(exception.getMessage()); } catch (GitAPIException exception) { if (exception.getMessage().endsWith("already exists")) { - throw new GitException(String.format(ERROR_BRANCH_NAME_EXISTS, name != null ? name : cleanRemoteName(trackBranch))); + throw new GitException(format(ERROR_BRANCH_NAME_EXISTS, name != null ? name : cleanRemoteName(trackBranch))); } throw new GitException(exception.getMessage(), exception); } diff --git a/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitConnectionFactory.java b/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitConnectionFactory.java index 64ae43846..720ebf44c 100644 --- a/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitConnectionFactory.java +++ b/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitConnectionFactory.java @@ -14,7 +14,7 @@ import org.eclipse.che.api.core.util.LineConsumerFactory; import org.eclipse.che.api.git.CredentialsLoader; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.git.impl.jgit.ssh.SshKeyProvider; import org.eclipse.jgit.internal.storage.file.FileRepository; import org.eclipse.jgit.lib.Constants; diff --git a/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitStatusImpl.java b/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitStatusImpl.java index 8db99d10d..7a5af0876 100644 --- a/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitStatusImpl.java +++ b/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/JGitStatusImpl.java @@ -11,7 +11,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.jgit; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.InfoPage; import org.eclipse.che.api.git.shared.Status; import org.eclipse.che.api.git.shared.StatusFormat; diff --git a/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/ssh/SshKeyProvider.java b/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/ssh/SshKeyProvider.java index 15ed916f0..3ca206429 100644 --- a/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/ssh/SshKeyProvider.java +++ b/che-core-git-impl-jgit/src/main/java/org/eclipse/che/git/impl/jgit/ssh/SshKeyProvider.java @@ -11,7 +11,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.jgit.ssh; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; /** * @author Igor Vinokur diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/CommandProcess.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/CommandProcess.java index 1fc2c1d82..3b61ec282 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/CommandProcess.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/CommandProcess.java @@ -18,7 +18,7 @@ import org.eclipse.che.api.core.util.LineConsumerFactory; import org.eclipse.che.api.core.util.ProcessUtil; import org.eclipse.che.api.core.util.Watchdog; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.git.impl.nativegit.commands.GitCommand; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ConfigImpl.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ConfigImpl.java index 1b9e1c026..64d2d215a 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ConfigImpl.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ConfigImpl.java @@ -12,7 +12,7 @@ import org.eclipse.che.api.git.Config; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.git.impl.nativegit.commands.GetConfigCommand; import org.eclipse.che.git.impl.nativegit.commands.SetConfigCommand; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/GitAskPassScript.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/GitAskPassScript.java index 715cf0cdb..9ae788073 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/GitAskPassScript.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/GitAskPassScript.java @@ -13,7 +13,7 @@ import org.eclipse.che.api.git.UserCredential; import org.eclipse.che.commons.env.EnvironmentContext; import org.eclipse.che.commons.lang.IoUtil; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGit.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGit.java index 964e161c9..de182c19e 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGit.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGit.java @@ -13,7 +13,7 @@ import org.eclipse.che.api.core.util.LineConsumerFactory; import org.eclipse.che.api.git.Config; import org.eclipse.che.api.git.CredentialsLoader; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.git.impl.nativegit.commands.AddCommand; import org.eclipse.che.git.impl.nativegit.commands.CheckoutCommand; import org.eclipse.che.git.impl.nativegit.commands.BranchCreateCommand; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitConnection.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitConnection.java index ac084bc2c..ec3a0df07 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitConnection.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitConnection.java @@ -16,7 +16,7 @@ import org.eclipse.che.api.git.CredentialsLoader; import org.eclipse.che.api.git.DiffPage; import org.eclipse.che.api.git.GitConnection; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.LogPage; import org.eclipse.che.api.git.UserCredential; import org.eclipse.che.api.git.shared.AddRequest; @@ -76,11 +76,9 @@ import org.eclipse.che.git.impl.nativegit.commands.RemoteOperationCommand; import org.eclipse.che.git.impl.nativegit.ssh.GitSshScriptProvider; -import java.io.BufferedWriter; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; -import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitConnectionFactory.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitConnectionFactory.java index a3890dc7a..26260cd43 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitConnectionFactory.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitConnectionFactory.java @@ -12,10 +12,9 @@ import org.eclipse.che.api.core.util.LineConsumerFactory; import org.eclipse.che.api.git.CredentialsLoader; -import org.eclipse.che.api.git.CredentialsProvider; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.git.impl.nativegit.ssh.GitSshScriptProvider; import javax.inject.Inject; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitDiffPage.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitDiffPage.java index 5b21321bf..640d590d6 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitDiffPage.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitDiffPage.java @@ -13,7 +13,7 @@ import org.eclipse.che.api.git.DiffPage; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.DiffRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitStatusImpl.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitStatusImpl.java index 073633899..946a32663 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitStatusImpl.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitStatusImpl.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.InfoPage; import org.eclipse.che.api.git.shared.Status; import org.eclipse.che.api.git.shared.StatusFormat; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/AddCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/AddCommand.java index 53d7fa634..a83a13552 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/AddCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/AddCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; import java.util.List; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchCreateCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchCreateCommand.java index 9d8be2a9e..acf0ec8c2 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchCreateCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchCreateCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchDeleteCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchDeleteCommand.java index c475e79d2..a609fe315 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchDeleteCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchDeleteCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.CredentialsLoader; import org.eclipse.che.git.impl.nativegit.GitAskPassScript; import org.eclipse.che.git.impl.nativegit.ssh.GitSshScriptProvider; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchListCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchListCommand.java index caefd7dfb..396298689 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchListCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchListCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.Branch; import org.eclipse.che.dto.server.DtoFactory; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchRenameCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchRenameCommand.java index d61fe5f3a..d8d0ea333 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchRenameCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/BranchRenameCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.CredentialsLoader; import org.eclipse.che.git.impl.nativegit.GitAskPassScript; import org.eclipse.che.git.impl.nativegit.ssh.GitSshScriptProvider; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/CheckoutCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/CheckoutCommand.java index 093e1a2fc..d4baadca6 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/CheckoutCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/CheckoutCommand.java @@ -11,7 +11,7 @@ package org.eclipse.che.git.impl.nativegit.commands; import java.util.List; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/CloneCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/CloneCommand.java index df9cd99e2..8e2879c08 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/CloneCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/CloneCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.CredentialsLoader; import org.eclipse.che.git.impl.nativegit.GitAskPassScript; import org.eclipse.che.git.impl.nativegit.ssh.GitSshScriptProvider; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/CommitCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/CommitCommand.java index 410f0ec3d..28734fedf 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/CommitCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/CommitCommand.java @@ -11,7 +11,7 @@ package org.eclipse.che.git.impl.nativegit.commands; import org.eclipse.che.api.core.util.SystemInfo; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.GitUser; import org.slf4j.Logger; @@ -21,9 +21,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * Commit changes diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/DiffCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/DiffCommand.java index bbf0f927c..1f65779a6 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/DiffCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/DiffCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.DiffRequest; import java.io.File; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/EmptyGitCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/EmptyGitCommand.java index abf0e82e2..bc14063a3 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/EmptyGitCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/EmptyGitCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; import java.util.LinkedList; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/FetchCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/FetchCommand.java index f44aa7bea..a6265319f 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/FetchCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/FetchCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.CredentialsLoader; import org.eclipse.che.git.impl.nativegit.GitAskPassScript; import org.eclipse.che.git.impl.nativegit.ssh.GitSshScriptProvider; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/GetConfigCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/GetConfigCommand.java index 08af781f6..d5ed34c0a 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/GetConfigCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/GetConfigCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/GitCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/GitCommand.java index b358fa88d..adc8bd863 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/GitCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/GitCommand.java @@ -13,7 +13,7 @@ import org.eclipse.che.api.core.util.CommandLine; import org.eclipse.che.api.core.util.LineConsumerFactory; import org.eclipse.che.api.core.util.ListLineConsumer; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.git.impl.nativegit.CommandProcess; import java.io.File; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/InitCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/InitCommand.java index eec2ceabc..77b450bea 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/InitCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/InitCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/ListFilesCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/ListFilesCommand.java index 6286e83ab..75cc4bd2c 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/ListFilesCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/ListFilesCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; import java.util.List; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/LogCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/LogCommand.java index 0d40e3dde..fe7d09ef5 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/LogCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/LogCommand.java @@ -11,7 +11,7 @@ package org.eclipse.che.git.impl.nativegit.commands; import org.eclipse.che.dto.server.DtoFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.GitUser; import org.eclipse.che.api.git.shared.Revision; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/LsRemoteCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/LsRemoteCommand.java index 3a890362a..163400b5a 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/LsRemoteCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/LsRemoteCommand.java @@ -11,7 +11,7 @@ package org.eclipse.che.git.impl.nativegit.commands; import org.eclipse.che.dto.server.DtoFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.RemoteReference; import org.eclipse.che.api.git.CredentialsLoader; import org.eclipse.che.git.impl.nativegit.GitAskPassScript; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/MergeCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/MergeCommand.java index e19187bf4..b27a92f1a 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/MergeCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/MergeCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.GitUser; import org.eclipse.che.api.git.shared.MergeResult; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/MoveCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/MoveCommand.java index f725460f0..a9636e12d 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/MoveCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/MoveCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/PullCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/PullCommand.java index b7ca93f81..8aca46472 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/PullCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/PullCommand.java @@ -12,7 +12,7 @@ import com.google.common.base.Joiner; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.GitUser; import org.eclipse.che.api.git.shared.PullResponse; import org.eclipse.che.api.git.CredentialsLoader; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/PushCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/PushCommand.java index 85a49afc9..af7e563a8 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/PushCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/PushCommand.java @@ -12,7 +12,7 @@ import com.google.common.base.Joiner; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.PushResponse; import org.eclipse.che.api.git.CredentialsLoader; import org.eclipse.che.git.impl.nativegit.GitAskPassScript; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteAddCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteAddCommand.java index 766dbcc0b..a0395bf37 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteAddCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteAddCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; import java.util.List; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteDeleteCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteDeleteCommand.java index 6148d97c2..fd34bb210 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteDeleteCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteDeleteCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteListCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteListCommand.java index 94971defc..bc112aeca 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteListCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteListCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.Remote; import org.eclipse.che.dto.server.DtoFactory; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteOperationCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteOperationCommand.java index 1fc8b4762..2df824f3e 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteOperationCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteOperationCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.CredentialsLoader; import org.eclipse.che.api.git.GitUrlUtils; import org.eclipse.che.git.impl.nativegit.GitAskPassScript; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteUpdateCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteUpdateCommand.java index a10722eac..0a8f9e283 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteUpdateCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoteUpdateCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; import java.util.List; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoveCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoveCommand.java index 132eb090a..ec9f355e5 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoveCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/RemoveCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; import java.util.List; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/ResetCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/ResetCommand.java index 663731d5f..a0c77f34f 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/ResetCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/ResetCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; import java.util.List; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/SetConfigCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/SetConfigCommand.java index f48fbd74c..535857f3f 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/SetConfigCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/SetConfigCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.commons.lang.Pair; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/StatusCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/StatusCommand.java index abda737a2..bf1aa1cec 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/StatusCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/StatusCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.StatusFormat; import java.io.File; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/TagCreateCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/TagCreateCommand.java index d70a6863b..b41573ee1 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/TagCreateCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/TagCreateCommand.java @@ -11,13 +11,11 @@ package org.eclipse.che.git.impl.nativegit.commands; import org.eclipse.che.dto.server.DtoFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.GitUser; import org.eclipse.che.api.git.shared.Tag; import java.io.File; -import java.util.HashMap; -import java.util.Map; /** * Create tag diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/TagDeleteCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/TagDeleteCommand.java index a5aeab28a..76a4e456c 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/TagDeleteCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/TagDeleteCommand.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.commands; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/TagListCommand.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/TagListCommand.java index a6b0d89f3..0c8c4be56 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/TagListCommand.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/commands/TagListCommand.java @@ -11,7 +11,7 @@ package org.eclipse.che.git.impl.nativegit.commands; import org.eclipse.che.dto.server.DtoFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.Tag; import java.io.File; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/GitSshScript.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/GitSshScript.java index ac983f669..74b11b292 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/GitSshScript.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/GitSshScript.java @@ -13,7 +13,7 @@ import com.google.common.io.Files; import org.apache.commons.io.FileUtils; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/GitSshScriptProvider.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/GitSshScriptProvider.java index f4b35acce..a31a86d29 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/GitSshScriptProvider.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/GitSshScriptProvider.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.ssh; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import static org.eclipse.che.api.core.util.SystemInfo.isUnix; import static org.eclipse.che.api.core.util.SystemInfo.isWindows; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/SshKeyProvider.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/SshKeyProvider.java index 68b3d6b1b..ba5af3523 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/SshKeyProvider.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/SshKeyProvider.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.ssh; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; /** * @author Sergii Kabashniuk diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/UnixGitSshScript.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/UnixGitSshScript.java index a85c697bf..2b2dddc16 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/UnixGitSshScript.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/UnixGitSshScript.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.ssh; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; import java.io.IOException; diff --git a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/WindowsGitSshScript.java b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/WindowsGitSshScript.java index 3c12e6321..43fdc18e6 100644 --- a/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/WindowsGitSshScript.java +++ b/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/ssh/WindowsGitSshScript.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.ssh; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; import java.io.IOException; diff --git a/che-core-git-impl-native/src/test/java/org/eclipse/che/git/impl/GitConnectionFactoryProvider.java b/che-core-git-impl-native/src/test/java/org/eclipse/che/git/impl/GitConnectionFactoryProvider.java index 276bb373a..09543dea9 100644 --- a/che-core-git-impl-native/src/test/java/org/eclipse/che/git/impl/GitConnectionFactoryProvider.java +++ b/che-core-git-impl-native/src/test/java/org/eclipse/che/git/impl/GitConnectionFactoryProvider.java @@ -12,14 +12,12 @@ import com.google.common.io.Files; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.CredentialsLoader; import org.eclipse.che.git.impl.nativegit.NativeGitConnectionFactory; import org.eclipse.che.git.impl.nativegit.ssh.GitSshScriptProvider; import org.testng.annotations.DataProvider; -import java.io.File; - import static org.mockito.Mockito.mock; /** diff --git a/che-core-git-impl-native/src/test/java/org/eclipse/che/git/impl/nativegit/NativeGitConnectionTest.java b/che-core-git-impl-native/src/test/java/org/eclipse/che/git/impl/nativegit/NativeGitConnectionTest.java index fdee07a9b..642dbdcc9 100644 --- a/che-core-git-impl-native/src/test/java/org/eclipse/che/git/impl/nativegit/NativeGitConnectionTest.java +++ b/che-core-git-impl-native/src/test/java/org/eclipse/che/git/impl/nativegit/NativeGitConnectionTest.java @@ -13,7 +13,7 @@ import com.google.common.io.Files; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.testng.annotations.Test; import java.io.File; diff --git a/che-core-git-impl-native/src/test/java/org/eclipse/che/git/impl/nativegit/ssh/SshScriptProviderTest.java b/che-core-git-impl-native/src/test/java/org/eclipse/che/git/impl/nativegit/ssh/SshScriptProviderTest.java index 209ec2e52..5d37fb2e9 100644 --- a/che-core-git-impl-native/src/test/java/org/eclipse/che/git/impl/nativegit/ssh/SshScriptProviderTest.java +++ b/che-core-git-impl-native/src/test/java/org/eclipse/che/git/impl/nativegit/ssh/SshScriptProviderTest.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.che.git.impl.nativegit.ssh; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.testng.MockitoTestNGListener; diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/Config.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/Config.java index 269c6fdb9..a2b5cb033 100644 --- a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/Config.java +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/Config.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.che.api.git; +import org.eclipse.che.api.git.exception.GitException; + import java.io.File; import java.util.List; diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/CredentialsLoader.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/CredentialsLoader.java index c111944c6..7fab7f476 100644 --- a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/CredentialsLoader.java +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/CredentialsLoader.java @@ -11,6 +11,7 @@ package org.eclipse.che.api.git; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.GitUser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/CredentialsProvider.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/CredentialsProvider.java index 459666b47..5a768cd5e 100644 --- a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/CredentialsProvider.java +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/CredentialsProvider.java @@ -11,6 +11,7 @@ package org.eclipse.che.api.git; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.GitUser; /** diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitConnection.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitConnection.java index 844a680f7..efc3f56ce 100644 --- a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitConnection.java +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitConnection.java @@ -13,6 +13,7 @@ import org.eclipse.che.api.core.ServerException; import org.eclipse.che.api.core.UnauthorizedException; import org.eclipse.che.api.core.util.LineConsumerFactory; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.Branch; import org.eclipse.che.api.git.shared.CheckoutRequest; diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitConnectionFactory.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitConnectionFactory.java index 7911952b5..8936f77a7 100644 --- a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitConnectionFactory.java +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitConnectionFactory.java @@ -11,6 +11,7 @@ package org.eclipse.che.api.git; import org.eclipse.che.api.core.util.LineConsumerFactory; +import org.eclipse.che.api.git.exception.GitException; import java.io.File; diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitExceptionMapper.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitExceptionMapper.java new file mode 100644 index 000000000..62791b4bd --- /dev/null +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitExceptionMapper.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.api.git; + +import org.eclipse.che.api.git.exception.*; +import org.eclipse.che.api.git.shared.ConflictExceptionError; +import org.eclipse.che.dto.server.DtoFactory; + +import javax.inject.Singleton; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; +import javax.ws.rs.ext.Provider; + +import static org.eclipse.che.dto.server.DtoFactory.newDto; + +/** + * Exception mapper for all GIT exceptions + * + * @author Yossi Balan (yossi.balan@sap.com) + */ +@Provider +@Singleton +public class GitExceptionMapper implements ExceptionMapper { + + /** + * check the exception type and build Response with the status body and the type of the error + */ + @Override + public Response toResponse(GitException exception) { + if (exception instanceof GitRefNotFoundException) + return Response.status(Response.Status.NOT_FOUND) + .entity(DtoFactory.getInstance().toJson(exception.getServiceError())) + .type(MediaType.APPLICATION_JSON).build(); + else if (exception instanceof GitInvalidRefNameException) + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(DtoFactory.getInstance().toJson(exception.getServiceError())) + .type(MediaType.APPLICATION_JSON).build(); + else if (exception instanceof GitRefAlreadyExistsException) + return Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(DtoFactory.getInstance().toJson(exception.getServiceError())) + .type(MediaType.APPLICATION_JSON).build(); + else if (exception instanceof GitConflictException) { + ConflictExceptionError conflictExceptionError = newDto(ConflictExceptionError.class).withMessage(exception.getServiceError().getMessage()) + .withConflictingPaths(((GitConflictException) exception).getConflictPaths()); + return Response.status(Response.Status.CONFLICT) + .entity(DtoFactory.getInstance().toJson(conflictExceptionError)) + .type(MediaType.APPLICATION_JSON).build(); + } + return Response.serverError() + .entity(DtoFactory.getInstance() + .toJson(exception.getServiceError())) + .type(MediaType.APPLICATION_JSON).build(); + } + +} diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitModule.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitModule.java index 300a426ac..aee39d423 100644 --- a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitModule.java +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitModule.java @@ -38,6 +38,7 @@ protected void configure() { multiBinder.addBinding().to(GitValueProviderFactory.class); bind(GitService.class); + bind(GitExceptionMapper.class); bind(BranchListWriter.class); bind(CommitMessageWriter.class); bind(MergeResultWriter.class); diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitProjectImporter.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitProjectImporter.java index 440c26784..0ba78a89a 100644 --- a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitProjectImporter.java +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitProjectImporter.java @@ -14,8 +14,8 @@ import org.eclipse.che.api.core.ForbiddenException; import org.eclipse.che.api.core.ServerException; import org.eclipse.che.api.core.UnauthorizedException; -import org.eclipse.che.api.core.util.FileCleaner; import org.eclipse.che.api.core.util.LineConsumerFactory; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.project.server.FolderEntry; import org.eclipse.che.api.project.server.ProjectImporter; import org.eclipse.che.commons.lang.IoUtil; @@ -36,12 +36,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.BufferedWriter; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; -import java.nio.charset.Charset; -import java.nio.file.Files; import java.util.Collections; import java.util.List; import java.util.Map; diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitService.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitService.java index 20316918d..798e5b401 100644 --- a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitService.java +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitService.java @@ -12,6 +12,7 @@ import org.eclipse.che.api.core.ApiException; import org.eclipse.che.api.core.ServerException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.Branch; import org.eclipse.che.api.git.shared.CheckoutRequest; diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitConflictException.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitConflictException.java new file mode 100644 index 000000000..5392b9c60 --- /dev/null +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitConflictException.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.api.git.exception; + +import java.util.Collections; +import java.util.List; + +/** + * @author Yossi Balan (yossi.balan@sap.com) + */ +public class GitConflictException extends GitException { + + private List conflictingPaths = Collections.emptyList(); + + /** + * Constrcut a new GitConflictException based on message + * + * @param message + * error message + */ + public GitConflictException(String message) { + super(message); + } + + /** + * Constrcut a new GitConflictException based on message and conflict paths + * + * @param message + * error messgae + * @param conflictingPaths + * conflict path of the files + */ + public GitConflictException(String message, List conflictingPaths) { + super(message); + this.conflictingPaths = conflictingPaths; + } + + /** + * Constrcut a new GitConflictException based on cause + * + * @param cause + * cause exception + */ + public GitConflictException(Throwable cause) { + super(cause); + } + + /** + * Construct a new GitConflictException based on message and cause + * + @param message + * error message + * @param cause + * cause exception + */ + public GitConflictException(String message, Throwable cause) { + super(message, cause); + } + + /** + * Construct a new GitConflictException based on message, conflict paths and cause + * + * @param message + * cause exception + * @param conflictingPaths + * conflict paths of the files + * @param cause + * cause exception + */ + public GitConflictException(String message, List conflictingPaths, Throwable cause) { + super(message, cause); + this.conflictingPaths = conflictingPaths; + } + + /** + * get the conflict paths + * + * @return conflict paths of the files + */ + public List getConflictPaths(){ + return this.conflictingPaths; + } + +} diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitException.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitException.java similarity index 95% rename from platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitException.java rename to platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitException.java index 76c7b2c9b..50936cfcb 100644 --- a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitException.java +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitException.java @@ -8,7 +8,7 @@ * Contributors: * Codenvy, S.A. - initial API and implementation *******************************************************************************/ -package org.eclipse.che.api.git; +package org.eclipse.che.api.git.exception; import org.eclipse.che.api.core.ServerException; diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitInvalidRefNameException.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitInvalidRefNameException.java new file mode 100644 index 000000000..415541208 --- /dev/null +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitInvalidRefNameException.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.api.git.exception; + +/** + * @author Yossi Balan (yossi.balan@sap.com) + */ +public class GitInvalidRefNameException extends GitException { + + /** + * Construct a new GitInvalidRefNameException based on message + * + * @param message + * error message + */ + public GitInvalidRefNameException(String message) { + super(message); + } + + /** + * Construct a new GitInvalidRefNameException based on cause + * + * @param cause + * cause exception + */ + public GitInvalidRefNameException(Throwable cause) { + super(cause); + } + + /** + * Construct a new GitInvalidRefNameException based on message and cause + * + * @param message + * error message + * @param cause + * cause exception + */ + public GitInvalidRefNameException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitRefAlreadyExistsException.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitRefAlreadyExistsException.java new file mode 100644 index 000000000..1e318194e --- /dev/null +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitRefAlreadyExistsException.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.api.git.exception; + +/** + * @author Yossi Balan (yossi.balan@sap.com) + */ +public class GitRefAlreadyExistsException extends GitException { + + /** + * Construct a new GitRefAlreadyExistsException based on message + * + * @param message + * error message + */ + public GitRefAlreadyExistsException(String message) { + super(message); + } + + /** + * Construct a new GitRefAlreadyExistsException base on cause + * + * @param cause + * cause exception + */ + public GitRefAlreadyExistsException(Throwable cause) { + super(cause); + } + + /** + * Construct a new GitRefAlreadyExistsException based on message and cause + * + * @param message + * error message + * @param cause + * cause exception + */ + public GitRefAlreadyExistsException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitRefNotFoundException.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitRefNotFoundException.java new file mode 100644 index 000000000..b949c1c12 --- /dev/null +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/exception/GitRefNotFoundException.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.api.git.exception; + +/** + * @author Yossi Balan (yossi.balan@sap.com) + */ +public class GitRefNotFoundException extends GitException { + + /** + * Construct a new GitRefNotFoundException based on message + * + * @param message + * error message + */ + public GitRefNotFoundException(String message) { + super(message); + } + + /** + * Construct a new GitRefNotFoundException based on cause + * + * @param cause + * cause exception + */ + public GitRefNotFoundException(Throwable cause) { + super(cause); + } + + /** + * Construct a new GitRefNotFoundException based on message and cause + * + * @param message + * error message + * @param cause + * cause exception + */ + public GitRefNotFoundException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/shared/ConflictExceptionError.java b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/shared/ConflictExceptionError.java new file mode 100644 index 000000000..21ca0c58a --- /dev/null +++ b/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/shared/ConflictExceptionError.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2012-2016 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.api.git.shared; + +import org.eclipse.che.dto.shared.DTO; + +import java.util.List; + +/** + * Conflict Exception Error + * + * @author Yossi Balan (yossi.balan@sap.com) + */ +@DTO +public interface ConflictExceptionError { + + /** + * Get conflict paths. + * + * @return conflict paths + */ + List getConflictingPaths(); + + ConflictExceptionError withConflictingPaths(List conflictPaths); + + /** + * Set conflict paths. + * + * @param conflictPaths + * conflict paths + */ + void setConflictingPaths(List conflictPaths); + + /** + * Get error message. + * + * @return error message + */ + String getMessage(); + + ConflictExceptionError withMessage(String message); + + /** + * Set error message. + * + * @param message + * error message + */ + void setMessage(String message); +} diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/api/git/GitServiceTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/api/git/GitServiceTest.java index eeac02131..b6996953f 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/api/git/GitServiceTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/api/git/GitServiceTest.java @@ -12,6 +12,7 @@ import com.jayway.restassured.http.ContentType; import com.jayway.restassured.response.Response; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.ConfigRequest; import org.eclipse.che.api.vfs.server.MountPoint; import org.eclipse.che.api.vfs.server.VirtualFileSystem; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/AddTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/AddTest.java index 60359ab48..8ff716d8f 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/AddTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/AddTest.java @@ -23,7 +23,7 @@ import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.CommitRequest; import org.eclipse.che.api.git.shared.LsFilesRequest; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/BranchCreateTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/BranchCreateTest.java index ac0c6c4ea..792866b0f 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/BranchCreateTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/BranchCreateTest.java @@ -15,7 +15,7 @@ import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.Branch; import org.eclipse.che.api.git.shared.CheckoutRequest; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/BranchDeleteTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/BranchDeleteTest.java index ec6716ce4..e90d7cd19 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/BranchDeleteTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/BranchDeleteTest.java @@ -17,7 +17,7 @@ import org.eclipse.che.api.core.UnauthorizedException; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.Branch; import org.eclipse.che.api.git.shared.CheckoutRequest; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/CheckoutTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/CheckoutTest.java index 6fd547fef..149f336a1 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/CheckoutTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/CheckoutTest.java @@ -18,13 +18,12 @@ import org.eclipse.che.api.core.UnauthorizedException; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.CheckoutRequest; import org.eclipse.che.api.git.shared.BranchCreateRequest; import org.eclipse.che.api.git.shared.BranchListRequest; import org.eclipse.che.api.git.shared.CommitRequest; -import org.eclipse.che.api.git.shared.PullRequest; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/CommitTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/CommitTest.java index a1edd7679..ee26ad838 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/CommitTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/CommitTest.java @@ -15,7 +15,7 @@ import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.CommitRequest; import org.eclipse.che.api.git.shared.LogRequest; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/ConfigTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/ConfigTest.java index 75c8aaecb..5dd34c435 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/ConfigTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/ConfigTest.java @@ -14,7 +14,7 @@ import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/DiffTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/DiffTest.java index cff0dd420..1b834da63 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/DiffTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/DiffTest.java @@ -16,7 +16,7 @@ import org.eclipse.che.api.git.DiffPage; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.CommitRequest; import org.eclipse.che.api.git.shared.DiffRequest; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/FetchTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/FetchTest.java index 544e99020..d1c37d742 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/FetchTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/FetchTest.java @@ -15,7 +15,7 @@ import org.eclipse.che.api.core.UnauthorizedException; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.CheckoutRequest; import org.eclipse.che.api.git.shared.CloneRequest; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/GetCommitersTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/GetCommitersTest.java index e695b1497..4d5692b55 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/GetCommitersTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/GetCommitersTest.java @@ -14,7 +14,7 @@ import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.CommitRequest; import org.eclipse.che.api.git.shared.GitUser; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/GitTestUtil.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/GitTestUtil.java index fdb9b6b37..062ec7611 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/GitTestUtil.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/GitTestUtil.java @@ -12,7 +12,7 @@ import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.CommitRequest; import org.eclipse.che.api.git.shared.GitUser; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/InitTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/InitTest.java index e74ee0dfc..2ae218e60 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/InitTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/InitTest.java @@ -14,7 +14,7 @@ import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.InitRequest; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/LsRemoteTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/LsRemoteTest.java index 36b139314..8ec29d237 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/LsRemoteTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/LsRemoteTest.java @@ -15,7 +15,7 @@ import org.eclipse.che.api.core.UnauthorizedException; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.LsRemoteRequest; import org.eclipse.che.api.git.shared.RemoteReference; import org.testng.annotations.AfterMethod; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/PullTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/PullTest.java index 048442159..3cb231a25 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/PullTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/PullTest.java @@ -16,7 +16,7 @@ import org.eclipse.che.api.core.UnauthorizedException; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.CheckoutRequest; import org.eclipse.che.api.git.shared.BranchListRequest; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/PushTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/PushTest.java index 104d23dd9..b4ff45b24 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/PushTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/PushTest.java @@ -16,7 +16,7 @@ import org.eclipse.che.api.core.UnauthorizedException; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.AddRequest; import org.eclipse.che.api.git.shared.CheckoutRequest; import org.eclipse.che.api.git.shared.BranchListRequest; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoteAddTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoteAddTest.java index d36bb666f..3eb03f113 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoteAddTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoteAddTest.java @@ -16,7 +16,7 @@ import org.eclipse.che.api.core.UnauthorizedException; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.Branch; import org.eclipse.che.api.git.shared.BranchCreateRequest; import org.eclipse.che.api.git.shared.BranchListRequest; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoteDeleteTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoteDeleteTest.java index 7094490d0..455f91ddc 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoteDeleteTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoteDeleteTest.java @@ -13,7 +13,7 @@ import com.google.common.io.Files; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.RemoteAddRequest; import org.eclipse.che.api.git.shared.RemoteListRequest; import org.testng.annotations.AfterMethod; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoteUpdateTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoteUpdateTest.java index 9db0f9a7b..c041f80d7 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoteUpdateTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoteUpdateTest.java @@ -14,7 +14,7 @@ import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.RemoteAddRequest; import org.eclipse.che.api.git.shared.RemoteUpdateRequest; import org.testng.annotations.AfterMethod; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoveTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoveTest.java index 9735f7065..e32c0bc8d 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoveTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/RemoveTest.java @@ -13,7 +13,7 @@ import com.google.common.io.Files; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.RmRequest; import org.eclipse.che.api.git.shared.StatusFormat; import org.testng.annotations.AfterMethod; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/TagCreateTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/TagCreateTest.java index fa3c072ba..f8d4c5ef8 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/TagCreateTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/TagCreateTest.java @@ -13,7 +13,7 @@ import com.google.common.io.Files; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.TagCreateRequest; import org.eclipse.che.api.git.shared.TagListRequest; import org.testng.annotations.AfterMethod; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/TagDeleteTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/TagDeleteTest.java index 3fb778ead..9cd172840 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/TagDeleteTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/TagDeleteTest.java @@ -13,7 +13,7 @@ import com.google.common.io.Files; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.*; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; diff --git a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/TagListTest.java b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/TagListTest.java index 8f995a6d3..57cbf4636 100644 --- a/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/TagListTest.java +++ b/platform-api/che-core-api-git/src/test/java/org/eclipse/che/git/impl/TagListTest.java @@ -13,7 +13,7 @@ import com.google.common.io.Files; import org.eclipse.che.api.git.GitConnection; import org.eclipse.che.api.git.GitConnectionFactory; -import org.eclipse.che.api.git.GitException; +import org.eclipse.che.api.git.exception.GitException; import org.eclipse.che.api.git.shared.*; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod;