summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-07 16:20:55 (EDT)
committerChris Aniszczyk2011-04-07 17:26:16 (EDT)
commit1eea7cf73f527475e162a51e80a717bbf6208a4d (patch)
tree9890e0c68a8e63607864206f9407739a2899fe14
parenta193f511f425b8ee1b9b4197dcd7ca14b5154d2a (diff)
downloadegit-github-1eea7cf73f527475e162a51e80a717bbf6208a4d.zip
egit-github-1eea7cf73f527475e162a51e80a717bbf6208a4d.tar.gz
egit-github-1eea7cf73f527475e162a51e80a717bbf6208a4d.tar.bz2
Add missing credentials on GitHubService.showIssuerefs/changes/16/3016/2
This fixes 401 exceptions being thrown when issue in private repository is refreshed in task editor. Change-Id: Ie0fc780a8e439699a203184070de5cf4fd06c56e Signed-off-by: Kevin Sawicki <kevin@github.com>
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java3
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubService.java5
-rw-r--r--org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/GitHubServiceTest.java3
3 files changed, 8 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java
index c86ffe0..681bdb7 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java
@@ -154,7 +154,8 @@ public class GitHubRepositoryConnector extends AbstractRepositoryConnector {
String project = GitHub.computeTaskRepositoryProject(repository.getUrl());
try {
- GitHubIssue issue = service.showIssue(user, project, taskId);
+ GitHubCredentials credentials = GitHubCredentials.create(repository);
+ GitHubIssue issue = service.showIssue(user, project, taskId, credentials);
TaskData taskData = taskDataHandler.createTaskData(repository, monitor, user, project, issue);
return taskData;
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubService.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubService.java
index 3d4a1e8..17171f6 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubService.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubService.java
@@ -480,13 +480,16 @@ public class GitHubService {
}
}
- public GitHubIssue showIssue(final String user, final String repo,final String issueNumber) throws GitHubServiceException {
+ public GitHubIssue showIssue(final String user, final String repo,
+ final String issueNumber, final GitHubCredentials credentials)
+ throws GitHubServiceException {
GetMethod method = null;
try {
// build HTTP GET method
method = new GetMethod(gitURLBase + gitIssueRoot + SHOW
+ user + "/" + repo + "/" + issueNumber);
+ setCredentials(credentials);
// execute HTTP GET method
executeMethod(method);
// transform JSON to Java object
diff --git a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/GitHubServiceTest.java b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/GitHubServiceTest.java
index 9eabcfd..0997c3a 100644
--- a/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/GitHubServiceTest.java
+++ b/org.eclipse.mylyn.github.tests/src/org/eclipse/mylyn/github/tests/GitHubServiceTest.java
@@ -88,7 +88,8 @@ public class GitHubServiceTest {
service.editIssue(TEST_USER, TEST_PROJECT, issue, new GitHubCredentials(TEST_USER,API_KEY));
- GitHubIssue showIssue = service.showIssue(TEST_USER, TEST_PROJECT, issue.getNumber());
+ GitHubIssue showIssue = service.showIssue(TEST_USER, TEST_PROJECT,
+ issue.getNumber(), new GitHubCredentials(TEST_USER, API_KEY));
assertTrue(showIssue != null);
assertEquals(newIssue.getTitle(),showIssue.getTitle());