You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/12/07 19:39:44 UTC

DO NOT REPLY [Bug 32573] New: - NPE: map.LRUMap.reuseMapping(LRUMap.java:272)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32573>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32573

           Summary: NPE: map.LRUMap.reuseMapping(LRUMap.java:272)
           Product: Commons
           Version: 3.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Collections
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: otis@apache.org


I'm using Collections 3.1 and just found this NPE in my logs:

java.lang.NullPointerException
        at
org.apache.commons.collections.map.LRUMap.reuseMapping(LRUMap.java:272)
        at
org.apache.commons.collections.map.LRUMap.addMapping(LRUMap.java:243)
        at
org.apache.commons.collections.map.AbstractHashedMap.put(AbstractHashedMap.java:282)

I instantiated LRUMap like this:

  LRUMap map = new LRUMap(31);

And from there on, I use it like I'd use any Map, putting things into
it, and so on.  Maybe I'm not using LRUMap correctly?  My _guess_ is
that this occurs when the Map is full, but I am not certain.

I am wrapping the LRUMap in my own Maps as follows, but I think they're
not the culprit:

  LRUMap map = new LRUMap(31);
    _userSessions = new ExpiringMap(map,
       new TimerTTLReferenceHolder(1800000), // ttl=30min
       300000);                              // purge frequency=5min


The only similar thing I found is bug 28887, but it looks like that was fixed
before 3.1 release.

I understand the value of a self-contained unit test that demonstrates this bug,
but it happens only occassionally on my production system, never during
development, so I can't really come up with it :(

My guess is that this is a boundary case, as line 272 is:

 loop = loop.next;

So 'loop' is most likely null, and it's null because ... not sure, maybe that
hashIndex is wrong.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org