]> source.dussan.org Git - gitblit.git/commitdiff
Reduce use of final to avoid Wicket serialization issues in reflogs
authorJames Moger <james.moger@gitblit.com>
Mon, 3 Mar 2014 22:28:19 +0000 (17:28 -0500)
committerJames Moger <james.moger@gitblit.com>
Mon, 3 Mar 2014 22:28:19 +0000 (17:28 -0500)
src/main/java/com/gitblit/wicket/panels/DigestsPanel.java
src/main/java/com/gitblit/wicket/panels/ReflogPanel.java

index 237db04d812dcfcd5bf89404e1cfb6ddca8650c1..ee97635f8e7523461ab72431de622c8e6dac6ab8 100644 (file)
@@ -19,7 +19,6 @@ import java.text.DateFormat;
 import java.text.MessageFormat;\r
 import java.text.SimpleDateFormat;\r
 import java.util.ArrayList;\r
-import java.util.Calendar;\r
 import java.util.Date;\r
 import java.util.List;\r
 import java.util.TimeZone;\r
@@ -55,14 +54,6 @@ public class DigestsPanel extends BasePanel {
                super(wicketId);\r
                hasChanges = digests.size() > 0;\r
 \r
-               final int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);\r
-\r
-               String dateFormat = app().settings().getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy");\r
-               final TimeZone timezone = getTimeZone();\r
-               final DateFormat df = new SimpleDateFormat(dateFormat);\r
-               df.setTimeZone(timezone);\r
-               final Calendar cal = Calendar.getInstance(timezone);\r
-\r
                ListDataProvider<DailyLogEntry> dp = new ListDataProvider<DailyLogEntry>(digests);\r
                DataView<DailyLogEntry> pushView = new DataView<DailyLogEntry>("change", dp) {\r
                        private static final long serialVersionUID = 1L;\r
@@ -70,6 +61,12 @@ public class DigestsPanel extends BasePanel {
                        @Override\r
                        public void populateItem(final Item<DailyLogEntry> logItem) {\r
                                final DailyLogEntry change = logItem.getModelObject();\r
+\r
+                               String dateFormat = app().settings().getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy");\r
+                               TimeZone timezone = getTimeZone();\r
+                               DateFormat df = new SimpleDateFormat(dateFormat);\r
+                               df.setTimeZone(timezone);\r
+\r
                                String fullRefName = change.getChangedRefs().get(0);\r
                                String shortRefName = fullRefName;\r
                                boolean isTag = false;\r
@@ -233,6 +230,7 @@ public class DigestsPanel extends BasePanel {
                                                commitItem.add(shortlog);\r
 \r
                                                // commit hash link\r
+                                               int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);\r
                                                LinkPanel commitHash = new LinkPanel("hashLink", null, commit.getName().substring(0, hashLen),\r
                                                                CommitPage.class, WicketUtils.newObjectParameter(\r
                                                                                change.repository, commit.getName()));\r
index 35fd681bb536733d865af9610aa7a1e9cf5ed38e..70f598634aedbf7161423a41f8456874f2c798f1 100644 (file)
@@ -110,13 +110,6 @@ public class ReflogPanel extends BasePanel {
        }\r
 \r
        protected void setup(List<RefLogEntry> changes) {\r
-               final int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);\r
-\r
-               String dateFormat = app().settings().getString(Keys.web.datetimestampLongFormat, "EEEE, MMMM d, yyyy HH:mm Z");\r
-               final TimeZone timezone = getTimeZone();\r
-               final DateFormat df = new SimpleDateFormat(dateFormat);\r
-               df.setTimeZone(timezone);\r
-               final Calendar cal = Calendar.getInstance(timezone);\r
 \r
                ListDataProvider<RefLogEntry> dp = new ListDataProvider<RefLogEntry>(changes);\r
                DataView<RefLogEntry> changeView = new DataView<RefLogEntry>("change", dp) {\r
@@ -125,6 +118,13 @@ public class ReflogPanel extends BasePanel {
                        @Override\r
                        public void populateItem(final Item<RefLogEntry> changeItem) {\r
                                final RefLogEntry change = changeItem.getModelObject();\r
+\r
+                               String dateFormat = app().settings().getString(Keys.web.datetimestampLongFormat, "EEEE, MMMM d, yyyy HH:mm Z");\r
+                               TimeZone timezone = getTimeZone();\r
+                               DateFormat df = new SimpleDateFormat(dateFormat);\r
+                               df.setTimeZone(timezone);\r
+                               Calendar cal = Calendar.getInstance(timezone);\r
+\r
                                String fullRefName = change.getChangedRefs().get(0);\r
                                String shortRefName = fullRefName;\r
                                boolean isTag = false;\r
@@ -286,6 +286,7 @@ public class ReflogPanel extends BasePanel {
                                                commitItem.add(shortlog);\r
 \r
                                                // commit hash link\r
+                                               int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6);\r
                                                LinkPanel commitHash = new LinkPanel("hashLink", null, commit.getName().substring(0, hashLen),\r
                                                                CommitPage.class, WicketUtils.newObjectParameter(\r
                                                                                change.repository, commit.getName()));\r