Return immediately if local ref update fails
Minor simplification, as in this case we don't need to enter the
try/catch block at all.
Change-Id: I8bc177f0e254488b7181d0ab02a43559209a61f1
diff --git a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
index 35ad560..a8047e6 100644
--- a/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
+++ b/src/main/java/com/gerritforge/gerrit/globalrefdb/validation/RefUpdateValidator.java
@@ -190,10 +190,11 @@
RefPair refPairForUpdate = newRefPairFrom(refUpdate);
compareAndGetLatestLocalRef(refPairForUpdate, locks);
RefUpdate.Result result = refUpdateFunction.invoke();
+ if (!isSuccessful(result)) {
+ return result;
+ }
try {
- if (isSuccessful(result)) {
- updateSharedDbOrThrowExceptionFor(refPairForUpdate);
- }
+ updateSharedDbOrThrowExceptionFor(refPairForUpdate);
} catch (Exception e) {
result = rollbackFunction.invoke(refPairForUpdate.compareRef.getObjectId());
if (isSuccessful(result)) {