import com.gitblit.models.PathModel.PathChangeModel;\r
import com.gitblit.models.RegistrantAccessPermission;\r
import com.gitblit.models.RepositoryModel;\r
+import com.gitblit.models.RepositoryUrl;\r
import com.gitblit.models.SubmoduleModel;\r
import com.gitblit.models.TicketModel;\r
import com.gitblit.models.TicketModel.Change;\r
import com.gitblit.tickets.TicketLabel;\r
import com.gitblit.tickets.TicketMilestone;\r
import com.gitblit.tickets.TicketResponsible;\r
+import com.gitblit.utils.ArrayUtils;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.JGitUtils.MergeStatus;\r
import com.gitblit.utils.MarkdownUtils;\r
*/\r
if (currentPatchset == null) {\r
// no patchset available\r
- if (ticket.isOpen() && app().tickets().isAcceptingNewPatchsets(repository)) {\r
+ String repoUrl = getRepositoryUrl(user, repository);\r
+ if (ticket.isOpen() && app().tickets().isAcceptingNewPatchsets(repository) && !StringUtils.isEmpty(repoUrl)) {\r
// ticket & repo will accept a proposal patchset\r
// show the instructions for proposing a patchset\r
- String repoUrl = getRepositoryUrl(user, repository);\r
Fragment changeIdFrag = new Fragment("patchset", "proposeFragment", this);\r
changeIdFrag.add(new Label("proposeInstructions", MarkdownUtils.transformMarkdown(getString("gb.proposeInstructions"))).setEscapeModelStrings(false));\r
changeIdFrag.add(new Label("ptWorkflow", MessageFormat.format(getString("gb.proposeWith"), "Barnum")));\r
*/\r
protected String getRepositoryUrl(UserModel user, RepositoryModel repository) {\r
HttpServletRequest req = ((WebRequest) getRequest()).getHttpServletRequest();\r
- String primaryurl = app().gitblit().getRepositoryUrls(req, user, repository).get(0).url;\r
+ List<RepositoryUrl> urls = app().gitblit().getRepositoryUrls(req, user, repository);\r
+ if (ArrayUtils.isEmpty(urls)) {\r
+ return null;\r
+ }\r
+ String primaryurl = urls.get(0).url;\r
String url = primaryurl;\r
try {\r
url = new URIish(primaryurl).setUser(null).toString();\r