# HG changeset patch # User alanb # Date 1267298955 0 # Node ID 8e7376ac6830014c94e0f7261ae89566f22e179b # Parent 3a3f498acc86d5d87f22df7c8eb4e80e712d0aa2 6921374: java.lang.String::hashCode() should check for count == 0 to avoid repeated stores hash = 0 Reviewed-by: darcy, ohair diff -r 3a3f498acc86 -r 8e7376ac6830 jdk/src/share/classes/java/lang/String.java --- a/jdk/src/share/classes/java/lang/String.java Sat Feb 27 19:26:59 2010 +0000 +++ b/jdk/src/share/classes/java/lang/String.java Sat Feb 27 19:29:15 2010 +0000 @@ -1492,7 +1492,7 @@ */ public int hashCode() { int h = hash; - if (h == 0) { + if (h == 0 && count > 0) { int off = offset; char val[] = value; int len = count;