diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-08-09 01:40:46 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-08-09 01:50:01 +0200 |
commit | 4b9ed3f678b6256082bf5408e7335b885cc114aa (patch) | |
tree | 65706174ba08c4e68cee71d66fc363fbe54e49a5 /org.eclipse.jgit/src | |
parent | b4cb06b294bbb7747bd0322bf055b06613c5fb51 (diff) | |
download | jgit-4b9ed3f678b6256082bf5408e7335b885cc114aa.tar.gz jgit-4b9ed3f678b6256082bf5408e7335b885cc114aa.zip |
[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>
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java index 6cbddec543..13f71a7ff6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitBuilder.java @@ -57,6 +57,7 @@ import java.text.MessageFormat; 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 class CommitBuilder { 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 class CommitBuilder { 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"); |