diff options
author | Paul Martin <paul@paulsputer.com> | 2016-04-01 19:02:37 +0100 |
---|---|---|
committer | Paul Martin <paul@paulsputer.com> | 2016-04-01 19:02:37 +0100 |
commit | 2c545280196ded9c042c0a8fa564048338bc19de (patch) | |
tree | aea6a53d4e2994ca07c25162d88e8d7298457ef3 | |
parent | 33f3580f8f4499ac9cd4812872c94fcdd81a5829 (diff) | |
parent | 10f798a1fab5f7b23f498e2746b1b6a50010a288 (diff) | |
download | gitblit-2c545280196ded9c042c0a8fa564048338bc19de.tar.gz gitblit-2c545280196ded9c042c0a8fa564048338bc19de.zip |
Merge pull request #1035 from gitblit/1034-RepositoryPageLifecycle
Fix for #1034 Ticket Page Error
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/RepositoryPage.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java b/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java index 8958eb2a..36c5ae16 100644 --- a/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java +++ b/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java @@ -269,8 +269,15 @@ public abstract class RepositoryPage extends RootPage { @Override
protected void setupPage(String repositoryName, String pageName) {
+
+ //This method should only be called once in the page lifecycle.
+ //However, it must be called after the constructor has run, hence not in onInitialize
+ //It may be attempted to be called again if an info or error message is displayed.
+ if (get("projectTitle") != null) { return; }
+
String projectName = StringUtils.getFirstPathElement(repositoryName);
ProjectModel project = app().projects().getProjectModel(projectName);
+
if (project.isUserProject()) {
// user-as-project
add(new LinkPanel("projectTitle", null, project.getDisplayName(),
@@ -662,15 +669,7 @@ public abstract class RepositoryPage extends RootPage { }
}
- @Override
- protected void onInitialize() {
-
- super.onInitialize();
- // setup page header and footer
- setupPage(getRepositoryName(), "/ " + getPageName());
- }
-
@Override
protected void onBeforeRender() {
// dispose of repository object
@@ -678,6 +677,9 @@ public abstract class RepositoryPage extends RootPage { r.close();
r = null;
}
+
+ // setup page header and footer
+ setupPage(getRepositoryName(), "/ " + getPageName());
super.onBeforeRender();
}
|