This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

CachingProvider seems to freak out on saving as well sometimes, as RecentChanges throws a NullPointerException every now and then.


MahlenMorris: What looks to me is going on is that this chunk of code in CachingProvider (line 181):

                    CacheItem item = new CacheItem();
                    item.m_page = (WikiPage) i.next();
is creating a WikiPage with no date. This WikiPage will get used the next time getAllPages() is called, and in trying to sort it, the NPE gets thrown. Honestly, I'm not even sure what that loop is doing, though; firstly, I'm surprised the (WikiPage) i.next() even compiled, since i.next() should be a String, no? Is the WikiPage(String) constructor getting called there implicitly? That's too funky. Plus it's iterating through the cache and setting items in the cache at the same time; that puts the fear in me, and I'm not even sure what the purpose is of that loop, it seems like you're clearing the text out of the cache for no reason. Not to imply that it doesn't make sense, it's just not obvious to me yet. I haven't tested this, but from staring at the code that not-setting-the-date appears to be the problem. I just want RecentChanges to work so my RPC Email Notification stuff can work :)

Yeah. It was actually iterating through a wrong collection - namely itself. Mega-oops. :-) It's fixed now in 1.6.8, and hopefully we should get no more NPEs. Thanks! (And having fear was a proper reaction - it certainly looked scary to me too. Must. Stop. Coding. Late. At. Night.) --JanneJalkanen


Update: Still crashes. Stymied. But have some guesses. Now sleep. --JanneJalkanen

MahlenMorris: Well, in looking at the code last night (before i added the note above) I noticed there were a few places in the code that create a new WikiPage object without setting the date. So fixing all of them (even though not all may be used) should help. Also, it wouldn't be hard to bulletproof the date Comparator method you're using to not crash when it encounters a null date (it should probably do the email-the-admin thing, of course). If i have time tonight when i get home and the code drop has occurred, I'll take another peek. Can you describe the behavior more? Is there some event that triggers it, or something that clears it?

Well, it worked before adding a CachingProvider. Also, it works most of the time, but then it crashes after a while. These suggest to me that there might be an interesting race condition, a concurrency issue, a garbage collector issue, or some other exotic creature lying around. I'd rather know the real reason behind the problem than patch the symptoms... Makes for better code later on. :-) --JanneJalkanen

Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 31-Jan-2002 17:20 by 192.100.124.220.