summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AllInOnePatchScreen.java15
-rw-r--r--gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/topic/ChangeSetInfoFactory.java3
-rw-r--r--gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/topic/ChangeSetInfoNotAvailableException.java5
-rw-r--r--gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java5
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/ChangeUtil.java18
5 files changed, 38 insertions, 8 deletions
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AllInOnePatchScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AllInOnePatchScreen.java
index 90fb7e3d0b..67caaca0b9 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AllInOnePatchScreen.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AllInOnePatchScreen.java
@@ -33,6 +33,7 @@ import com.google.gerrit.reviewdb.AccountDiffPreference;
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.Patch;
import com.google.gerrit.reviewdb.PatchSet;
+import com.google.gerrit.reviewdb.PatchSet.Id;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.dom.client.KeyPressEvent;
@@ -215,11 +216,13 @@ public class AllInOnePatchScreen extends AbstractPatchScreen implements
private KeyNavigation keyNavigation;
private List<Diff> diffs;
private Diff.Factory diffFactory;
+ private Id id;
public AllInOnePatchScreen(final PatchSet.Id patchSetId,
final PatchSetDetail detail, final PatchTable patchTable,
AbstractPatchScreen.Type patchScreenType) {
super(null, patchSetId, detail, patchTable);
+ setPatchId(patchSetId);
diffs = new ArrayList<Diff>();
keyNavigation = new KeyNavigation(this);
keyNavigation.addNavigationKey(new UpToChangeCommand(patchSetId, 0, 'u'));
@@ -318,6 +321,14 @@ public class AllInOnePatchScreen extends AbstractPatchScreen implements
lastScript = null;
}
+ private Id getPatchId() {
+ return id;
+ }
+
+ private void setPatchId(Id id) {
+ this.id = id;
+ }
+
private boolean canReuse(AccountDiffPreference dp, PatchScript last) {
if (last.getDiffPrefs().getIgnoreWhitespace() != dp.getIgnoreWhitespace()) {
// Whitespace ignore setting requires server computation.
@@ -399,7 +410,7 @@ public class AllInOnePatchScreen extends AbstractPatchScreen implements
private void loadFileList() {
if (patchSetDetail == null) {
- Util.DETAIL_SVC.patchSetDetail(idSideB,
+ Util.DETAIL_SVC.patchSetDetail(getPatchId(),
new GerritCallback<PatchSetDetail>() {
@Override
public void onSuccess(PatchSetDetail result) {
@@ -467,7 +478,7 @@ public class AllInOnePatchScreen extends AbstractPatchScreen implements
files = new VerticalPanel();
approvalPanel = new FlowPanel();
- approvals = new Approvals(idSideB);
+ approvals = new Approvals(getPatchId());
approvals.addDelegate(this);
approvalPanel.add(approvals);
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/topic/ChangeSetInfoFactory.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/topic/ChangeSetInfoFactory.java
index b62dd8ff3d..a686a095e0 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/topic/ChangeSetInfoFactory.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/topic/ChangeSetInfoFactory.java
@@ -54,6 +54,9 @@ public class ChangeSetInfoFactory {
final List<ChangeSetElement> changeSetElements = db.changeSetElements().byChangeSet(csId).toList();
// Our data source will be the last change in the ChangeSet
//
+ if(changeSetElements.isEmpty()){
+ throw new ChangeSetInfoNotAvailableException();
+ }
final Change.Id changeId = changeSetElements.get(changeSetElements.size() - 1).getChangeId();
final Change change = db.changes().get(changeId);
final PatchSet patchSet = db.patchSets().get(change.currentPatchSetId());
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/topic/ChangeSetInfoNotAvailableException.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/topic/ChangeSetInfoNotAvailableException.java
index 90426304a4..902c444e7b 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/topic/ChangeSetInfoNotAvailableException.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/topic/ChangeSetInfoNotAvailableException.java
@@ -16,9 +16,14 @@ package com.google.gerrit.httpd.rpc.topic;
public final class ChangeSetInfoNotAvailableException extends Exception {
private static final long serialVersionUID = 1L;
+ public static final String MESSAGE = "No change set elements in list";
public ChangeSetInfoNotAvailableException(Exception cause) {
super(cause);
}
+ public ChangeSetInfoNotAvailableException() {
+ super(MESSAGE);
+ }
+
}
diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java
index a551ebb84b..ebaf0c8076 100644
--- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java
+++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/AccountGeneralPreferences.java
@@ -43,7 +43,10 @@ public final class AccountGeneralPreferences {
US("MM/dd", "MM/dd/yy"),
/** ISO style dates: 2010-02-14 */
- ISO("MM-dd", "yyyy-MM-dd");
+ ISO("MM-dd", "yyyy-MM-dd"),
+
+ /** European style dates: 27. Apr, 27.04.2010 */
+ EURO("d. MMM", "dd.MM.yyyy");
private final String shortFormat;
private final String longFormat;
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/ChangeUtil.java b/gerrit-server/src/main/java/com/google/gerrit/server/ChangeUtil.java
index f1e2b08454..960af5c9a3 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/ChangeUtil.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/ChangeUtil.java
@@ -67,6 +67,8 @@ import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.util.Base64;
import org.eclipse.jgit.util.NB;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
@@ -79,6 +81,8 @@ import java.util.regex.Matcher;
public class ChangeUtil {
private static int uuidPrefix;
private static int uuidSeq;
+ private static final Logger log = LoggerFactory
+ .getLogger(ChangeUtil.class);
/**
* Generate a new unique identifier for change message entities.
@@ -280,11 +284,15 @@ public class ChangeUtil {
}
db.patchSetApprovals().update(approvals);
- // Email the reviewers
- final AbandonedSender cm = senderFactory.create(updatedChange);
- cm.setFrom(user.getAccountId());
- cm.setChangeMessage(cmsg);
- cm.send();
+ if (senderFactory != null) {
+ // Email the reviewers
+ final AbandonedSender cm = senderFactory.create(updatedChange);
+ cm.setFrom(user.getAccountId());
+ cm.setChangeMessage(cmsg);
+ cm.send();
+ } else {
+ log.error("Abandoned sender factory is null!");
+ }
hooks.doChangeAbandonedHook(updatedChange, user.getAccount(), message);
}