[error prone] fix ReferenceEquality warning in CommitBuilder

Comparing with UTF_8 constant in StandardCharsets doesn't require to use
equals.

Change-Id: I6c73a929367f32c9e76ce99f6c0af268480d9230
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2019-08-09 01:40:46 +02:00
parent b4cb06b294
commit 4b9ed3f678
1 changed files with 3 additions and 2 deletions

View File

@ -57,6 +57,7 @@
import java.util.List;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.util.References;
/**
* Mutable builder to construct a commit recording the state of a project.
@ -365,7 +366,7 @@ public byte[] build() throws UnsupportedEncodingException {
os.write('\n');
}
if (getEncoding() != UTF_8) {
if (!References.isSameObject(getEncoding(), UTF_8)) {
os.write(hencoding);
os.write(' ');
os.write(Constants.encodeASCII(getEncoding().name()));
@ -474,7 +475,7 @@ public String toString() {
r.append(gpgSignature != null ? gpgSignature.toString() : "NOT_SET");
r.append("\n");
if (encoding != null && encoding != UTF_8) {
if (encoding != null && !References.isSameObject(encoding, UTF_8)) {
r.append("encoding ");
r.append(encoding.name());
r.append("\n");