diff options
author | Robin Rosenberg | 2012-05-30 00:24:18 +0000 |
---|---|---|
committer | Matthias Sohn | 2012-05-30 00:24:18 +0000 |
commit | bda268636a1de7077bd28484a201988883bae1c9 (patch) | |
tree | 7342fbd4f90001ec3de5b98b31c177d0370707f6 /org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java | |
parent | 64417af7a7e0d74ee423d6642d40a5116f584fe1 (diff) | |
download | egit-bda268636a1de7077bd28484a201988883bae1c9.tar.gz egit-bda268636a1de7077bd28484a201988883bae1c9.tar.xz egit-bda268636a1de7077bd28484a201988883bae1c9.zip |
Git API does not declare GitAPIException call() and related changes
Anyone that calls a Git API should catch GitAPIException and not just
the currently known exceptions.
During the process of cleaning this up a number of cases, but not all
cases, where only checked exceptions are thrown, are changed to
catch all Exceptions except Error.
This changes adapt EGit to changes made in JGit for this reason.
Bug: 366914
JGit-Change-Id: I50380f13fc82c22d0036f47c7859cc3a77e767c5
Change-Id: I4de4902003a9f306912475e8b15b1e72d43e7475
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java')
-rw-r--r-- | org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java index 8b0435f9aa..e662f2c96a 100644 --- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java +++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/CommitOperation.java @@ -31,13 +31,8 @@ import org.eclipse.egit.core.project.RepositoryMapping; import org.eclipse.jgit.api.AddCommand; import org.eclipse.jgit.api.CommitCommand; import org.eclipse.jgit.api.Git; -import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException; +import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.JGitInternalException; -import org.eclipse.jgit.api.errors.NoFilepatternException; -import org.eclipse.jgit.api.errors.NoHeadException; -import org.eclipse.jgit.api.errors.NoMessageException; -import org.eclipse.jgit.api.errors.WrongRepositoryStateException; -import org.eclipse.jgit.errors.UnmergedPathException; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; @@ -217,13 +212,12 @@ public class CommitOperation implements IEGitOperation { addCommand.addFilepattern(path); fileAdded = true; } - if (fileAdded) { + if (fileAdded) try { addCommand.call(); - } catch (NoFilepatternException e) { + } catch (Exception e) { throw new CoreException(Activator.error(e.getMessage(), e)); } - } } public ISchedulingRule getSchedulingRule() { @@ -253,20 +247,9 @@ public class CommitOperation implements IEGitOperation { for(String path:commitFileList) commitCommand.setOnly(path); commit = commitCommand.call(); - } catch (NoHeadException e) { - throw new TeamException(e.getLocalizedMessage(), e); - } catch (NoMessageException e) { - throw new TeamException(e.getLocalizedMessage(), e); - } catch (UnmergedPathException e) { - throw new TeamException(e.getLocalizedMessage(), e); - } catch (ConcurrentRefUpdateException e) { - throw new TeamException( - CoreText.MergeOperation_InternalError, e); - } catch (JGitInternalException e) { + } catch (Exception e) { throw new TeamException( CoreText.MergeOperation_InternalError, e); - } catch (WrongRepositoryStateException e) { - throw new TeamException(e.getLocalizedMessage(), e); } } @@ -316,17 +299,9 @@ public class CommitOperation implements IEGitOperation { new PersonIdent(committerIdent, commitDate, timeZone)).setMessage(message) .setInsertChangeId(createChangeId).call(); - } catch (NoHeadException e) { - throw new TeamException(e.getLocalizedMessage(), e); - } catch (NoMessageException e) { - throw new TeamException(e.getLocalizedMessage(), e); - } catch (UnmergedPathException e) { - throw new TeamException(e.getLocalizedMessage(), e); - } catch (ConcurrentRefUpdateException e) { - throw new TeamException(CoreText.MergeOperation_InternalError, e); } catch (JGitInternalException e) { throw new TeamException(CoreText.MergeOperation_InternalError, e); - } catch (WrongRepositoryStateException e) { + } catch (GitAPIException e) { throw new TeamException(e.getLocalizedMessage(), e); } } |