468758: update o.e.m.Versions to JGit 4.0
Change-Id: I2ef2ae18753d0b4233f6d22d0a53e1a6aa0dc4b6
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=468758
Signed-off-by: Sam Davis <sam.davis@tasktop.com>
diff --git a/org.eclipse.mylyn.git.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.git.ui/META-INF/MANIFEST.MF
index abf25d9..e71e4e0 100644
--- a/org.eclipse.mylyn.git.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.git.ui/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@
org.eclipse.egit.core,
org.eclipse.egit.ui,
org.eclipse.mylyn.git.core,
- org.eclipse.jgit
+ org.eclipse.jgit,
+ org.apache.commons.lang;bundle-version="2.6.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Localization: plugin
diff --git a/org.eclipse.mylyn.git.ui/src/org/eclipse/mylyn/internal/git/ui/connector/GitConnectorUi.java b/org.eclipse.mylyn.git.ui/src/org/eclipse/mylyn/internal/git/ui/connector/GitConnectorUi.java
index 6866ef9..9abf074 100644
--- a/org.eclipse.mylyn.git.ui/src/org/eclipse/mylyn/internal/git/ui/connector/GitConnectorUi.java
+++ b/org.eclipse.mylyn.git.ui/src/org/eclipse/mylyn/internal/git/ui/connector/GitConnectorUi.java
@@ -11,9 +11,14 @@
*******************************************************************************/
package org.eclipse.mylyn.internal.git.ui.connector;
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.commons.lang.reflect.MethodUtils;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.egit.core.GitProvider;
import org.eclipse.egit.ui.internal.commit.CommitEditor;
import org.eclipse.egit.ui.internal.commit.RepositoryCommit;
@@ -22,6 +27,7 @@
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.git.core.GitRepository;
import org.eclipse.mylyn.internal.git.ui.GetChangeSetDialog;
import org.eclipse.mylyn.versions.core.ChangeSet;
@@ -80,7 +86,19 @@
return null;
} finally {
if (revWalk != null) {
- revWalk.release();
+ release(revWalk);
+ }
+ }
+ }
+
+ private void release(RevWalk revWalk) {
+ try {
+ MethodUtils.invokeMethod(revWalk, "release", null); //$NON-NLS-1$
+ } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+ try {
+ MethodUtils.invokeMethod(revWalk, "close", null); //$NON-NLS-1$
+ } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e1) {
+ StatusHandler.log(new Status(IStatus.ERROR, ID_PLUGIN, "Failed to release revWalk " + revWalk, e1)); //$NON-NLS-1$
}
}
}