diff options
author | James Moger <james.moger@gitblit.com> | 2014-03-12 21:12:06 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-03-12 21:12:06 -0400 |
commit | b236cef19b443aaf91a2ac72a94f70f6ccc228b1 (patch) | |
tree | f62ff219c6e558e576af9f6b5820d3cbeab7f731 /src/main/java/com/gitblit/wicket/pages | |
parent | a66312f3d4bb9f1f6aad5ed66d2082057c99f519 (diff) | |
download | gitblit-b236cef19b443aaf91a2ac72a94f70f6ccc228b1.tar.gz gitblit-b236cef19b443aaf91a2ac72a94f70f6ccc228b1.zip |
Fix ticket page IOBE when Gitblit is not serving repositories
Diffstat (limited to 'src/main/java/com/gitblit/wicket/pages')
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/TicketPage.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.java b/src/main/java/com/gitblit/wicket/pages/TicketPage.java index 80b55766..498a9db6 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.java @@ -64,6 +64,7 @@ import com.gitblit.git.PatchsetReceivePack; import com.gitblit.models.PathModel.PathChangeModel;
import com.gitblit.models.RegistrantAccessPermission;
import com.gitblit.models.RepositoryModel;
+import com.gitblit.models.RepositoryUrl;
import com.gitblit.models.SubmoduleModel;
import com.gitblit.models.TicketModel;
import com.gitblit.models.TicketModel.Change;
@@ -79,6 +80,7 @@ import com.gitblit.tickets.TicketIndexer.Lucene; import com.gitblit.tickets.TicketLabel;
import com.gitblit.tickets.TicketMilestone;
import com.gitblit.tickets.TicketResponsible;
+import com.gitblit.utils.ArrayUtils;
import com.gitblit.utils.JGitUtils;
import com.gitblit.utils.JGitUtils.MergeStatus;
import com.gitblit.utils.MarkdownUtils;
@@ -732,10 +734,10 @@ public class TicketPage extends TicketBasePage { */
if (currentPatchset == null) {
// no patchset available
- if (ticket.isOpen() && app().tickets().isAcceptingNewPatchsets(repository)) {
+ String repoUrl = getRepositoryUrl(user, repository);
+ if (ticket.isOpen() && app().tickets().isAcceptingNewPatchsets(repository) && !StringUtils.isEmpty(repoUrl)) {
// ticket & repo will accept a proposal patchset
// show the instructions for proposing a patchset
- String repoUrl = getRepositoryUrl(user, repository);
Fragment changeIdFrag = new Fragment("patchset", "proposeFragment", this);
changeIdFrag.add(new Label("proposeInstructions", MarkdownUtils.transformMarkdown(getString("gb.proposeInstructions"))).setEscapeModelStrings(false));
changeIdFrag.add(new Label("ptWorkflow", MessageFormat.format(getString("gb.proposeWith"), "Barnum")));
@@ -1476,7 +1478,11 @@ public class TicketPage extends TicketBasePage { */
protected String getRepositoryUrl(UserModel user, RepositoryModel repository) {
HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest();
- String primaryurl = app().gitblit().getRepositoryUrls(req, user, repository).get(0).url;
+ List<RepositoryUrl> urls = app().gitblit().getRepositoryUrls(req, user, repository);
+ if (ArrayUtils.isEmpty(urls)) {
+ return null;
+ }
+ String primaryurl = urls.get(0).url;
String url = primaryurl;
try {
url = new URIish(primaryurl).setUser(null).toString();
|