Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 61776 invoked from network); 1 Jul 2007 02:56:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Jul 2007 02:56:27 -0000 Received: (qmail 39914 invoked by uid 500); 1 Jul 2007 02:56:28 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 39898 invoked by uid 500); 1 Jul 2007 02:56:28 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 39885 invoked by uid 99); 1 Jul 2007 02:56:28 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 30 Jun 2007 19:56:28 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 30 Jun 2007 19:56:24 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 961147141EB for ; Sat, 30 Jun 2007 19:56:04 -0700 (PDT) Message-ID: <23760922.1183258564611.JavaMail.jira@brutus> Date: Sat, 30 Jun 2007 19:56:04 -0700 (PDT) From: "Henri Yandell (JIRA)" To: commons-dev@jakarta.apache.org Subject: [jira] Commented: (COLLECTIONS-3) NPE: map.LRUMap.reuseMapping(LRUMap.java:272) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COLLECTIONS-3?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509351 ] Henri Yandell commented on COLLECTIONS-3: ----------------------------------------- That should be: synchronized(map) { Playing with SoakLRUMap, not doing that gives a ConcurrentModificationException, which hasn't been reported so far. Mostly I get IllegalStateExceptions when playing with SoakLRUMap and not synchronizing the Map, however I did get one NPE still: java.lang.NullPointerException at org.apache.commons.collections.map.LRUMap.moveToMRU(LRUMap.java:194) at org.apache.commons.collections.map.LRUMap.updateEntry(LRUMap.java:217) Line is: entry.before.after = entry.after; Which, looking at the code, implies that entry.before is null. Maybe another place to put a state check? Maybe a state check would be worth it there too? > NPE: map.LRUMap.reuseMapping(LRUMap.java:272) > --------------------------------------------- > > Key: COLLECTIONS-3 > URL: https://issues.apache.org/jira/browse/COLLECTIONS-3 > Project: Commons Collections > Issue Type: Bug > Components: Map > Affects Versions: 3.1 > Environment: Operating System: Linux > Platform: PC > Reporter: Otis Gospodnetic > Attachments: commons-collections-3.2-LRUMap-debug.jar, LRUMap.java, SoakLRUMap.java > > > 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 COM-1288, 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. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org