]> source.dussan.org Git - gitblit.git/commitdiff
Fix for #1034 Ticket Page Error 1035/head
authorPaul Martin <paul@paulsputer.com>
Thu, 31 Mar 2016 07:47:56 +0000 (08:47 +0100)
committerPaul Martin <paul@paulsputer.com>
Thu, 31 Mar 2016 07:47:56 +0000 (08:47 +0100)
src/main/java/com/gitblit/wicket/pages/RepositoryPage.java

index 8958eb2abbc5513c96b501ea1ec1216f900d3350..36c5ae16c4747d13f04006bbb963ae53dde40b98 100644 (file)
@@ -269,8 +269,15 @@ public abstract class RepositoryPage extends RootPage {
 \r
        @Override\r
        protected void setupPage(String repositoryName, String pageName) {\r
+               \r
+               //This method should only be called once in the page lifecycle.\r
+               //However, it must be called after the constructor has run, hence not in onInitialize\r
+               //It may be attempted to be called again if an info or error message is displayed.\r
+               if (get("projectTitle") != null) { return; }\r
+               \r
                String projectName = StringUtils.getFirstPathElement(repositoryName);\r
                ProjectModel project = app().projects().getProjectModel(projectName);\r
+\r
                if (project.isUserProject()) {\r
                        // user-as-project\r
                        add(new LinkPanel("projectTitle", null, project.getDisplayName(),\r
@@ -662,15 +669,7 @@ public abstract class RepositoryPage extends RootPage {
                }\r
        }\r
 \r
-       @Override\r
-       protected void onInitialize() {\r
-\r
-               super.onInitialize();\r
 \r
-               // setup page header and footer\r
-               setupPage(getRepositoryName(), "/ " + getPageName());\r
-       }\r
-       \r
        @Override\r
        protected void onBeforeRender() {\r
                // dispose of repository object\r
@@ -678,6 +677,9 @@ public abstract class RepositoryPage extends RootPage {
                        r.close();\r
                        r = null;\r
                }\r
+               \r
+               // setup page header and footer\r
+               setupPage(getRepositoryName(), "/ " + getPageName());\r
 \r
                super.onBeforeRender();\r
        }\r