Fix MisusedWeekYear bug pattern flagged by error prone
Passing "YYYYMMdd-HHmmss" format to SimpleDateFormat ctor was failing
with:
error: [MisusedWeekYear] Use of "YYYY" (week year) in a date pattern
without "ww" (week in year). You probably meant to use "yyyy" (year) instead.
new SimpleDateFormat("YYYYMMdd-HHmmss").format(new Date()));
^
(see http://errorprone.info/bugpattern/MisusedWeekYear)
Did you mean 'new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date()));'
Change-Id: Ie51692fbacf06aed4a8920ca6dc0d75de47a1ee8
diff --git a/src/main/java/com/googlesource/gerrit/plugins/refprotection/BackupRef.java b/src/main/java/com/googlesource/gerrit/plugins/refprotection/BackupRef.java index de5014a..884d1ab 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/refprotection/BackupRef.java +++ b/src/main/java/com/googlesource/gerrit/plugins/refprotection/BackupRef.java
@@ -188,7 +188,7 @@ if (refName.startsWith(R_HEADS) || refName.startsWith(R_TAGS)) { return String.format("%s-%s", R_BACKUPS + refName.replaceFirst(R_REFS, ""), - new SimpleDateFormat("YYYYMMdd-HHmmss").format(new Date())); + new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date())); } return refName;