From f7df31e369b7ddd0f7d2e61b4328a2fc4c377451 Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 3 Mar 2014 17:28:19 -0500 Subject: Reduce use of final to avoid Wicket serialization issues in reflogs --- .../java/com/gitblit/wicket/panels/DigestsPanel.java | 16 +++++++--------- src/main/java/com/gitblit/wicket/panels/ReflogPanel.java | 15 ++++++++------- 2 files changed, 15 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/main/java/com/gitblit/wicket/panels/DigestsPanel.java b/src/main/java/com/gitblit/wicket/panels/DigestsPanel.java index 237db04d..ee97635f 100644 --- a/src/main/java/com/gitblit/wicket/panels/DigestsPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/DigestsPanel.java @@ -19,7 +19,6 @@ import java.text.DateFormat; import java.text.MessageFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.TimeZone; @@ -55,14 +54,6 @@ public class DigestsPanel extends BasePanel { super(wicketId); hasChanges = digests.size() > 0; - final int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6); - - String dateFormat = app().settings().getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy"); - final TimeZone timezone = getTimeZone(); - final DateFormat df = new SimpleDateFormat(dateFormat); - df.setTimeZone(timezone); - final Calendar cal = Calendar.getInstance(timezone); - ListDataProvider dp = new ListDataProvider(digests); DataView pushView = new DataView("change", dp) { private static final long serialVersionUID = 1L; @@ -70,6 +61,12 @@ public class DigestsPanel extends BasePanel { @Override public void populateItem(final Item logItem) { final DailyLogEntry change = logItem.getModelObject(); + + String dateFormat = app().settings().getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy"); + TimeZone timezone = getTimeZone(); + DateFormat df = new SimpleDateFormat(dateFormat); + df.setTimeZone(timezone); + String fullRefName = change.getChangedRefs().get(0); String shortRefName = fullRefName; boolean isTag = false; @@ -233,6 +230,7 @@ public class DigestsPanel extends BasePanel { commitItem.add(shortlog); // commit hash link + int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6); LinkPanel commitHash = new LinkPanel("hashLink", null, commit.getName().substring(0, hashLen), CommitPage.class, WicketUtils.newObjectParameter( change.repository, commit.getName())); diff --git a/src/main/java/com/gitblit/wicket/panels/ReflogPanel.java b/src/main/java/com/gitblit/wicket/panels/ReflogPanel.java index 35fd681b..70f59863 100644 --- a/src/main/java/com/gitblit/wicket/panels/ReflogPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/ReflogPanel.java @@ -110,13 +110,6 @@ public class ReflogPanel extends BasePanel { } protected void setup(List changes) { - final int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6); - - String dateFormat = app().settings().getString(Keys.web.datetimestampLongFormat, "EEEE, MMMM d, yyyy HH:mm Z"); - final TimeZone timezone = getTimeZone(); - final DateFormat df = new SimpleDateFormat(dateFormat); - df.setTimeZone(timezone); - final Calendar cal = Calendar.getInstance(timezone); ListDataProvider dp = new ListDataProvider(changes); DataView changeView = new DataView("change", dp) { @@ -125,6 +118,13 @@ public class ReflogPanel extends BasePanel { @Override public void populateItem(final Item changeItem) { final RefLogEntry change = changeItem.getModelObject(); + + String dateFormat = app().settings().getString(Keys.web.datetimestampLongFormat, "EEEE, MMMM d, yyyy HH:mm Z"); + TimeZone timezone = getTimeZone(); + DateFormat df = new SimpleDateFormat(dateFormat); + df.setTimeZone(timezone); + Calendar cal = Calendar.getInstance(timezone); + String fullRefName = change.getChangedRefs().get(0); String shortRefName = fullRefName; boolean isTag = false; @@ -286,6 +286,7 @@ public class ReflogPanel extends BasePanel { commitItem.add(shortlog); // commit hash link + int hashLen = app().settings().getInteger(Keys.web.shortCommitIdLength, 6); LinkPanel commitHash = new LinkPanel("hashLink", null, commit.getName().substring(0, hashLen), CommitPage.class, WicketUtils.newObjectParameter( change.repository, commit.getName())); -- cgit v1.2.3