changeset 2321:f7a6eae6e1eb

6921374: java.lang.String::hashCode() should check for count == 0 to avoid repeated stores hash = 0 Reviewed-by: darcy, ohair
author alanb
date Sat, 27 Feb 2010 19:29:15 +0000
parents 529d2da0aee2
children 893034df4ec2
files src/share/classes/java/lang/String.java
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/String.java	Sat Feb 27 19:26:59 2010 +0000
+++ b/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;