Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
NullPointer touching file in webdav mounted folder 6.1.2
In liferay 6.1.2 GA3 I'm getting following error when touching a non existent file in a mounted webdav folder
Caused by: java.lang.NullPointerException
at com.liferay.compat.hook.webdav.CompatDLWebDAVStorageImpl.isInstanceOfDLFileEntryResourceImpl(CompatDLWebDAVStorageImpl.java:299)
at com.liferay.compat.hook.webdav.CompatDLWebDAVStorageImpl.getResource(CompatDLWebDAVStorageImpl.java:77)
at com.liferay.compat.hook.webdav.CompatDLWebDAVStorageImpl.lockResource(CompatDLWebDAVStorageImpl.java:112)
at com.liferay.portal.webdav.methods.LockMethodImpl.doProcess(LockMethodImpl.java:127)
at com.liferay.portal.webdav.methods.LockMethodImpl.process(LockMethodImpl.java:51)
... 73 more
Seems to be in some kind of compatibility hook.
Debugging from webdav servlet it seems when I do a touch it calls
Folder folder = DLAppServiceUtil.getFolder(
webDavRequest.getGroupId(), parentFolderId, name);
in DLWebDAVStorageImpl
and it throws a NoSuchFolderException() since it's a new file...
in the exception it calls:
FileEntry fileEntry = DLAppServiceUtil.getFileEntry(
webDavRequest.getGroupId(), parentFolderId,
titleWithExtension);
which also throws NoSuchFileEntryException and returns null causing the above NullPointerException
but it's a new file so the resource doesn't exist so null seems correct to me and getResource should IMHO return null if that exception is thrown
As it is now exception is thrown and not caught in
Resource resource = getResource(webDAVRequest); in lockResource
I modified function as follows adding if (resource == null) check:
@Override
public Resource getResource(WebDAVRequest webDAVRequest)
throws WebDAVException {
Resource resource = super.getResource(webDAVRequest);
if (resource == null) {
return null;
}
if (isInstanceOfDLFileEntryResourceImpl(resource)) {
return toCompatResource(resource);
}
return resource;
}
That appears to fix issue
Caused by: java.lang.NullPointerException
at com.liferay.compat.hook.webdav.CompatDLWebDAVStorageImpl.isInstanceOfDLFileEntryResourceImpl(CompatDLWebDAVStorageImpl.java:299)
at com.liferay.compat.hook.webdav.CompatDLWebDAVStorageImpl.getResource(CompatDLWebDAVStorageImpl.java:77)
at com.liferay.compat.hook.webdav.CompatDLWebDAVStorageImpl.lockResource(CompatDLWebDAVStorageImpl.java:112)
at com.liferay.portal.webdav.methods.LockMethodImpl.doProcess(LockMethodImpl.java:127)
at com.liferay.portal.webdav.methods.LockMethodImpl.process(LockMethodImpl.java:51)
... 73 more
Seems to be in some kind of compatibility hook.
Debugging from webdav servlet it seems when I do a touch it calls
Folder folder = DLAppServiceUtil.getFolder(
webDavRequest.getGroupId(), parentFolderId, name);
in DLWebDAVStorageImpl
and it throws a NoSuchFolderException() since it's a new file...
in the exception it calls:
FileEntry fileEntry = DLAppServiceUtil.getFileEntry(
webDavRequest.getGroupId(), parentFolderId,
titleWithExtension);
which also throws NoSuchFileEntryException and returns null causing the above NullPointerException
but it's a new file so the resource doesn't exist so null seems correct to me and getResource should IMHO return null if that exception is thrown
As it is now exception is thrown and not caught in
Resource resource = getResource(webDAVRequest); in lockResource
I modified function as follows adding if (resource == null) check:
@Override
public Resource getResource(WebDAVRequest webDAVRequest)
throws WebDAVException {
Resource resource = super.getResource(webDAVRequest);
if (resource == null) {
return null;
}
if (isInstanceOfDLFileEntryResourceImpl(resource)) {
return toCompatResource(resource);
}
return resource;
}
That appears to fix issue
Community
Company
Feedback