From 54a024091c43e529185d404eb1ce8ad4df52149b Mon Sep 17 00:00:00 2001 From: shade Date: Tue, 14 Oct 2014 19:35:03 +0200 Subject: [PATCH] 8060485: (str) contentEquals checks the String contents twice on mismatch Reviewed-by: martin, chegar, alanb --- src/share/classes/java/lang/String.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/share/classes/java/lang/String.java b/src/share/classes/java/lang/String.java index ce7d8f779..483d1c68d 100644 --- a/src/share/classes/java/lang/String.java +++ b/src/share/classes/java/lang/String.java @@ -1045,8 +1045,9 @@ public final class String } } // Argument is a String - if (cs.equals(this)) - return true; + if (cs instanceof String) { + return equals(cs); + } // Argument is a generic CharSequence char v1[] = value; int n = v1.length; -- GitLab