Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0c71293

Browse filesBrowse files
Update src/main/java/org/kohsuke/github/GHIssue.java
Co-authored-by: Liam Newman <bitwiseman@gmail.com>
1 parent 1cdbc17 commit 0c71293
Copy full SHA for 0c71293

File tree

Expand file treeCollapse file tree

1 file changed

+8
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-5
lines changed

‎src/main/java/org/kohsuke/github/GHIssue.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHIssue.java
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ private String getRepositoryUrlPath() {
9696
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior")
9797
public GHRepository getRepository() {
9898
try {
99-
if (owner == null) {
100-
String repositoryUrlPath = getRepositoryUrlPath();
101-
wrap(root().createRequest().withUrlPath(repositoryUrlPath).fetch(GHRepository.class));
99+
synchronized (this) {
100+
if (owner == null) {
101+
String repositoryUrlPath = getRepositoryUrlPath();
102+
wrap(root().createRequest().withUrlPath(repositoryUrlPath).fetch(GHRepository.class));
103+
}
102104
}
103105
} catch (IOException e) {
104106
throw new GHException("Failed to fetch repository", e);
@@ -612,7 +614,8 @@ protected String getIssuesApiRoute() {
612614
final URL url = Objects.requireNonNull(getUrl(), "Missing instance URL!");
613615
return StringUtils.prependIfMissing(url.toString().replace(root().getApiUrl(), ""), "/");
614616
}
615-
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/issues/" + number;
617+
GHRepository repo = getRepository();
618+
return "/repos/" + repo.getOwnerName() + "/" + repo.getName() + "/issues/" + number;
616619
}
617620

618621
/**
@@ -757,7 +760,7 @@ protected static List<String> getLogins(Collection<GHUser> users) {
757760
*/
758761
public PagedIterable<GHIssueEvent> listEvents() throws IOException {
759762
return root().createRequest()
760-
.withUrlPath(owner.getApiTailUrl(String.format("/issues/%s/events", number)))
763+
.withUrlPath(getRepository().getApiTailUrl(String.format("/issues/%s/events", number)))
761764
.toIterable(GHIssueEvent[].class, item -> item.wrapUp(this));
762765
}
763766
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.