From d894921f6388d5467b26732c2e1d2bf61dbf2cf5 Mon Sep 17 00:00:00 2001 From: alanb Date: Sat, 27 Feb 2010 19:29:15 +0000 Subject: [PATCH] 6921374: java.lang.String::hashCode() should check for count == 0 to avoid repeated stores hash = 0 Reviewed-by: darcy, ohair --- jdk/src/share/classes/java/lang/String.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/share/classes/java/lang/String.java b/jdk/src/share/classes/java/lang/String.java index 6aaf7684bf..2aead0f545 100644 --- a/jdk/src/share/classes/java/lang/String.java +++ b/jdk/src/share/classes/java/lang/String.java @@ -1492,7 +1492,7 @@ public final class String */ public int hashCode() { int h = hash; - if (h == 0) { + if (h == 0 && count > 0) { int off = offset; char val[] = value; int len = count; -- GitLab