Tuesday, September 6, 2005

Found Resin Xml Bug

I've finally fixed bug which plagued my project for some time. The bug causes FileSystemPreferences to throw warning messages like this:
Couldn't flush user prefs: java.util.prefs.BackingStoreException: java.lang.NullPointerException
every 30 seconds.
This is happened on Resin 3.0.13. I fixed this by adding the following lines into my resin-web.xml.

The NPE is thrown on the line 321 of java.util.prefs.XmlSupport

319 | Element xmlMap = (Element) doc.getChildNodes().item(1);
returns null ^^^
320 | // check version
321 | String mapVersion = xmlMap.getAttribute("MAP_XML_VERSION");

Resin xml implementation would behave correctly if item(1) was modified to item(0). After several considerations I decide to stop using resin xml implementation in favor of default JDK 1.4 xml instead of creating my own implementation of Preferences.

No comments: