From 8e73bb056e8f3d52eced1ddf22c2d8c58a4d8261 Mon Sep 17 00:00:00 2001 From: Scott Marlow Date: Wed, 8 Aug 2012 21:46:54 -0400 Subject: [PATCH] HHH-7509 fix NPE in second level cache --- .../src/main/java/org/hibernate/cache/spi/CacheKey.java | 2 +- .../main/java/org/hibernate/cache/spi/NaturalIdCacheKey.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/CacheKey.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/CacheKey.java index 14d0e482a0..7719132da0 100755 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/CacheKey.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/CacheKey.java @@ -90,7 +90,7 @@ public class CacheKey implements Serializable { if ( this == other ) { return true; } - if ( hashCode != other.hashCode() || !(other instanceof CacheKey) ) { + if ( !(other instanceof CacheKey) || hashCode != other.hashCode()) { //hashCode is part of this check since it is pre-calculated and hash must match for equals to be true return false; } diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/NaturalIdCacheKey.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/NaturalIdCacheKey.java index 92a07f6ea3..4d87fec26e 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/NaturalIdCacheKey.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/spi/NaturalIdCacheKey.java @@ -141,7 +141,7 @@ public class NaturalIdCacheKey implements Serializable { return true; } - if ( hashCode != o.hashCode() || !(o instanceof NaturalIdCacheKey) ) { + if ( !(o instanceof NaturalIdCacheKey) || hashCode != o.hashCode() ) { //hashCode is part of this check since it is pre-calculated and hash must match for equals to be true return false; }