You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2008/04/02 08:06:48 UTC

svn commit: r643755 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LRUMap.java

Author: bayard
Date: Tue Apr  1 23:06:47 2008
New Revision: 643755

URL: http://svn.apache.org/viewvc?rev=643755&view=rev
Log:
Adding a state check as per COLLECTIONS-3. I got an NPE when running through tests without synchronization

Modified:
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LRUMap.java

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LRUMap.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LRUMap.java?rev=643755&r1=643754&r2=643755&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LRUMap.java (original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/LRUMap.java Tue Apr  1 23:06:47 2008
@@ -191,6 +191,11 @@
         if (entry.after != header) {
             modCount++;
             // remove
+            if(entry.before == null) {
+                throw new IllegalStateException("Entry.before is null." + 
+                    " Please check that your keys are immutable, and that you have used synchronization properly." +
+                    " If so, then please report this to dev@commons.apache.org as a bug.");
+            }
             entry.before.after = entry.after;
             entry.after.before = entry.before;
             // add first