@@ -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