MarkdownToHtml: Use String.equals to compare strings As reported by SpotBugs: This code compares java.lang.String objects for reference equality using the == or != operators. Unless both strings are either constants in a source file, or have been interned using the String.intern() method, the same string value may be represented by two different String objects. Consider using the equals(Object) method instead. Change-Id: Ie37a882900d02580f1f3d0d13327dfe9c45a746d
diff --git a/java/com/google/gitiles/doc/MarkdownToHtml.java b/java/com/google/gitiles/doc/MarkdownToHtml.java index 49a90f0..2f0f0ff 100644 --- a/java/com/google/gitiles/doc/MarkdownToHtml.java +++ b/java/com/google/gitiles/doc/MarkdownToHtml.java
@@ -242,7 +242,7 @@ .close("span") .close("a"); // github markdown compatibility - if (id != id.toLowerCase()) { + if (!id.equals(id.toLowerCase())) { html.open("a") .attribute("class", "h") .attribute("name", id.toLowerCase())