summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-03-03 17:28:19 -0500
committerJames Moger <james.moger@gitblit.com>2014-03-03 17:28:19 -0500
commitf7df31e369b7ddd0f7d2e61b4328a2fc4c377451 (patch)
tree3bbc5bc8e8d65fe8d3609ba7a478c3ec75caba43
parent7717756f44f0b477bc78544ad6762d10f32d03d0 (diff)
downloadgitblit-f7df31e369b7ddd0f7d2e61b4328a2fc4c377451.tar.gz
gitblit-f7df31e369b7ddd0f7d2e61b4328a2fc4c377451.zip
Reduce use of final to avoid Wicket serialization issues in reflogs
-rw-r--r--src/main/java/com/gitblit/wicket/panels/DigestsPanel.java16
-rw-r--r--src/main/java/com/gitblit/wicket/panels/ReflogPanel.java15
2 files changed, 15 insertions, 16 deletions
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<DailyLogEntry> dp = new ListDataProvider<DailyLogEntry>(digests);
DataView<DailyLogEntry> pushView = new DataView<DailyLogEntry>("change", dp) {
private static final long serialVersionUID = 1L;
@@ -70,6 +61,12 @@ public class DigestsPanel extends BasePanel {
@Override
public void populateItem(final Item<DailyLogEntry> 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<RefLogEntry> 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<RefLogEntry> dp = new ListDataProvider<RefLogEntry>(changes);
DataView<RefLogEntry> changeView = new DataView<RefLogEntry>("change", dp) {
@@ -125,6 +118,13 @@ public class ReflogPanel extends BasePanel {
@Override
public void populateItem(final Item<RefLogEntry> 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()));