<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>NullPointer touching file in webdav mounted folder 6.1.2</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=36147795" />
  <subtitle>NullPointer touching file in webdav mounted folder 6.1.2</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=36147795</id>
  <updated>2026-05-27T18:05:21Z</updated>
  <dc:date>2026-05-27T18:05:21Z</dc:date>
  <entry>
    <title>NullPointer touching file in webdav mounted folder 6.1.2</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=36147794" />
    <author>
      <name>K Boyce</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=36147794</id>
    <updated>2014-03-26T17:35:12Z</updated>
    <published>2014-03-26T17:35:12Z</published>
    <summary type="html">In liferay 6.1.2 GA3 I&amp;#39;m getting following error when touching a non existent file in a mounted webdav folder&lt;br /&gt;&lt;br /&gt;Caused by: java.lang.NullPointerException&lt;br /&gt;        at com.liferay.compat.hook.webdav.CompatDLWebDAVStorageImpl.isInstanceOfDLFileEntryResourceImpl(CompatDLWebDAVStorageImpl.java:299)&lt;br /&gt;        at com.liferay.compat.hook.webdav.CompatDLWebDAVStorageImpl.getResource(CompatDLWebDAVStorageImpl.java:77)&lt;br /&gt;        at com.liferay.compat.hook.webdav.CompatDLWebDAVStorageImpl.lockResource(CompatDLWebDAVStorageImpl.java:112)&lt;br /&gt;        at com.liferay.portal.webdav.methods.LockMethodImpl.doProcess(LockMethodImpl.java:127)&lt;br /&gt;        at com.liferay.portal.webdav.methods.LockMethodImpl.process(LockMethodImpl.java:51)&lt;br /&gt;        ... 73 more&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Seems to be in some kind of compatibility hook.&lt;br /&gt;&lt;br /&gt;Debugging from webdav servlet it seems when I do a touch it calls &lt;br /&gt;&lt;br /&gt;Folder folder = DLAppServiceUtil.getFolder(&lt;br /&gt;					webDavRequest.getGroupId(), parentFolderId, name);&lt;br /&gt;&lt;br /&gt;in DLWebDAVStorageImpl&lt;br /&gt;and it throws a NoSuchFolderException() since it&amp;#39;s a new file...&lt;br /&gt;&lt;br /&gt;in the exception it calls:&lt;br /&gt;FileEntry fileEntry = DLAppServiceUtil.getFileEntry(&lt;br /&gt;						webDavRequest.getGroupId(), parentFolderId,&lt;br /&gt;						titleWithExtension);&lt;br /&gt;which also throws NoSuchFileEntryException and returns null causing the above NullPointerException&lt;br /&gt;&lt;br /&gt;but it&amp;#39;s a new file so the resource doesn&amp;#39;t exist so null seems correct to me and getResource should IMHO return null if that exception is thrown&lt;br /&gt;&lt;br /&gt;As it is now exception is thrown and not caught in&lt;br /&gt;Resource resource = getResource(webDAVRequest); in lockResource&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I modified function as follows adding if (resource == null) check:&lt;br /&gt;	@Override&lt;br /&gt;	public Resource getResource(WebDAVRequest webDAVRequest)&lt;br /&gt;		throws WebDAVException {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;		Resource resource = super.getResource(webDAVRequest);&lt;br /&gt;&lt;br /&gt;                if (resource == null) {&lt;br /&gt;			return null;&lt;br /&gt;		}&lt;br /&gt;		if (isInstanceOfDLFileEntryResourceImpl(resource)) {&lt;br /&gt;			return toCompatResource(resource);&lt;br /&gt;		}&lt;br /&gt;&lt;br /&gt;		return resource;&lt;br /&gt;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That appears to fix issue</summary>
    <dc:creator>K Boyce</dc:creator>
    <dc:date>2014-03-26T17:35:12Z</dc:date>
  </entry>
</feed>
