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