Hi,
Its a content management application. I created some folders / files
and then deleted some files, all from the application and not from the
backend. It behaves properly most of the time but sometimes it throws
below exception.
[StandardWrapperValve.java:257:ERROR] Servlet.service() for servlet
WebslingerServlet threw exception
java.lang.NullPointerException
at
org.webslinger.commons.vfs.handlers.cow.COWStateXmlStorageHandler
$1.findIfExists(COWStateXmlStorageHandler.java:19)
at
org.webslinger.commons.vfs.handlers.cow.COWStateXmlStorageHandler
$1.findIfExists(COWStateXmlStorageHandler.java:16)
at org.webslinger.lang.ConcurrentCache.findIfExists
(ConcurrentCache.java:39)
at org.webslinger.lang.AbstractCache$ConcurrentDelegate.get
(AbstractCache.java:125)
at org.webslinger.lang.AbstractCache.get(AbstractCache.java:
287)
at org.webslinger.lang.ConcurrentCache.get
(ConcurrentCache.java:29)
at
org.webslinger.commons.vfs.handlers.cow.COWStateXmlStorageHandler.removeDeletedChildren
(COWStateXmlStorageHandler.j
ava:43)
at org.webslinger.commons.vfs.virtual.VirtualFileSystem
$VirtualResolution.getChildNames(VirtualFileSystem.java:542)
at
org.webslinger.commons.vfs.GenerationalFileObject.doListChildren
(GenerationalFileObject.java:51)
at
org.webslinger.commons.vfs.AbstractGenerifiedFileObject.resolveChildren
(AbstractGenerifiedFileObject.java:69)
at
org.webslinger.commons.vfs.AbstractGenerifiedFileObject.getChildren
(AbstractGenerifiedFileObject.java:54)
at
org.webslinger.commons.vfs.GenerationalFileObject.getChildren
(GenerationalFileObject.java:46)
at
org.webslinger.commons.vfs.flat.FlatFileObject.doListChildren
(FlatFileObject.java:103)
at
org.webslinger.commons.vfs.AbstractGenerifiedFileObject.resolveChildren
(AbstractGenerifiedFileObject.java:69)
at
org.webslinger.commons.vfs.AbstractGenerifiedFileObject.getChildren
(AbstractGenerifiedFileObject.java:54)
at org.webslinger.commons.vfs.virtual.VirtualFileSystem
$VirtualResolution.getChildNames(VirtualFileSystem.java:526)
at
org.webslinger.commons.vfs.GenerationalFileObject.doListChildren
(GenerationalFileObject.java:51)
I could see that the folder where files have been deleted contain
a .cowstate.xml which has following entry for each file deleted from
the application
<item deleted="true" name="<file name>"/>
I saw the code of the COWStateXmlStorageHandler constructor where a
new ConcurrentCache object has been created which contains the method
findIfExists(). Now from the method's name, I am assuming that it is
searching for the file ".cowstate.xml" using getFile() method. But as
I cannot debug it I am clueless that why the returned File object is
null and hence file.exists() is throwing the above
NullPointerException. Is it a OS issue that getFile() is failing? The
constructor code of COWStateXmlStorageHandler is here
public COWStateXmlStorageHandler() {
states = new ConcurrentCache<FileName, COWStateXml>
(COWStateXmlStorageHandler.class, "states", null,
ConcurrentCache.SOFT) {
protected COWStateXml findIfExists(FileName key) throws
Exception {
FileObject file = getFile(key);
return file.exists() ? new COWStateXml(file) : null;
}
protected COWStateXml createValue(FileName key) throws
Exception {
return new COWStateXml(getFile(key));
}
};
}
Please help as these errors are now coming frequently and is causing
much trouble.
Thanks,
Kaushik