Use emptyList() in CommitValidationException constructors
In the constructors that don't take a list of messages, use the emptyList helper to create the empty list instead of creating instances of ArrayList. Change-Id: Ic6494241c179d8220a4cffe4305eb672ec913d5e
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.git.validators;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CommitValidationException extends Exception {
|
||||
@@ -28,12 +28,12 @@ public class CommitValidationException extends Exception {
|
||||
|
||||
public CommitValidationException(String reason) {
|
||||
super(reason);
|
||||
this.messages = new ArrayList<CommitValidationMessage>();
|
||||
this.messages = Collections.emptyList();
|
||||
}
|
||||
|
||||
public CommitValidationException(String reason, Throwable why) {
|
||||
super(reason, why);
|
||||
this.messages = new ArrayList<CommitValidationMessage>();
|
||||
this.messages = Collections.emptyList();
|
||||
}
|
||||
|
||||
public List<CommitValidationMessage> getMessages() {
|
||||
|
||||
Reference in New Issue
Block a user