@@ -96,9 +96,11 @@ private String getRepositoryUrlPath() {
96
96
@ SuppressFBWarnings (value = { "EI_EXPOSE_REP" }, justification = "Expected behavior" )
97
97
public GHRepository getRepository () {
98
98
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
+ }
102
104
}
103
105
} catch (IOException e ) {
104
106
throw new GHException ("Failed to fetch repository" , e );
@@ -612,7 +614,8 @@ protected String getIssuesApiRoute() {
612
614
final URL url = Objects .requireNonNull (getUrl (), "Missing instance URL!" );
613
615
return StringUtils .prependIfMissing (url .toString ().replace (root ().getApiUrl (), "" ), "/" );
614
616
}
615
- return "/repos/" + owner .getOwnerName () + "/" + owner .getName () + "/issues/" + number ;
617
+ GHRepository repo = getRepository ();
618
+ return "/repos/" + repo .getOwnerName () + "/" + repo .getName () + "/issues/" + number ;
616
619
}
617
620
618
621
/**
@@ -757,7 +760,7 @@ protected static List<String> getLogins(Collection<GHUser> users) {
757
760
*/
758
761
public PagedIterable <GHIssueEvent > listEvents () throws IOException {
759
762
return root ().createRequest ()
760
- .withUrlPath (owner .getApiTailUrl (String .format ("/issues/%s/events" , number )))
763
+ .withUrlPath (getRepository () .getApiTailUrl (String .format ("/issues/%s/events" , number )))
761
764
.toIterable (GHIssueEvent [].class , item -> item .wrapUp (this ));
762
765
}
763
766
}
0 commit comments