Merge branch 'stable-2.11'

* stable-2.11:
  Update 2.11 release notes
  Fix minor bugs in ChangeHookRunner
  RebaseDialog: Organize imports
  Force javac to use -encoding UTF-8
  Fix NullPointerException when executing query with --comments option
  Remove '--recheck-mergeable' option in 2.11 release notes
  ReceiveCommits: Fix NPE when pushing to refs/changes/n
  ChangeControl: Optimize creation by not re-reading changes

Change-Id: Iab97e14b80b1867f785034544ecb33bb39aab2ef
This commit is contained in:
David Pursehouse
2015-02-26 10:00:48 +09:00
7 changed files with 57 additions and 10 deletions

View File

@@ -14,6 +14,7 @@
package com.google.gerrit.common;
import com.google.common.base.Strings;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.google.gerrit.common.data.ContributorAgreement;
@@ -263,7 +264,7 @@ public class ChangeHookRunner implements ChangeHooks, EventDispatcher,
draftPublishedHook = sitePath.resolve(new File(hooksPath, getValue(config, "hooks", "draftPublishedHook", "draft-published")).getPath());
commentAddedHook = sitePath.resolve(new File(hooksPath, getValue(config, "hooks", "commentAddedHook", "comment-added")).getPath());
changeMergedHook = sitePath.resolve(new File(hooksPath, getValue(config, "hooks", "changeMergedHook", "change-merged")).getPath());
mergeFailedHook = sitePath.resolve(new File(hooksPath, getValue(config, "hooks", "mergeFailed", "merge-failed")).getPath());
mergeFailedHook = sitePath.resolve(new File(hooksPath, getValue(config, "hooks", "mergeFailedHook", "merge-failed")).getPath());
changeAbandonedHook = sitePath.resolve(new File(hooksPath, getValue(config, "hooks", "changeAbandonedHook", "change-abandoned")).getPath());
changeRestoredHook = sitePath.resolve(new File(hooksPath, getValue(config, "hooks", "changeRestoredHook", "change-restored")).getPath());
refUpdatedHook = sitePath.resolve(new File(hooksPath, getValue(config, "hooks", "refUpdatedHook", "ref-updated")).getPath());
@@ -300,7 +301,7 @@ public class ChangeHookRunner implements ChangeHooks, EventDispatcher,
*/
private String getValue(final Config config, final String section, final String setting, final String fallback) {
final String result = config.getString(section, null, setting);
return (result == null) ? fallback : result;
return Strings.isNullOrEmpty(result) ? fallback : result;
}
/**

View File

@@ -2038,7 +2038,7 @@ public class ReceiveCommits {
@Override
public PatchSet.Id call() throws OrmException, IOException, NoSuchChangeException {
try {
if (magicBranch.edit) {
if (magicBranch != null && magicBranch.edit) {
return upsertEdit();
} else if (caller == Thread.currentThread()) {
return insertPatchSet(db);

View File

@@ -596,7 +596,7 @@ public class ChangeData {
public List<ChangeMessage> messages()
throws OrmException {
if (messages == null) {
messages = cmUtil.byChange(db, notes);
messages = cmUtil.byChange(db, notes());
}
return messages;
}