mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
WebDAV: fix broken litmus tests
NullPointerExceptions were being caused when affected node is not within a site and when no Content-Type header was sent by the client. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@34866 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -139,7 +139,7 @@ public class DeleteMethod extends WebDAVMethod implements ActivityPostProducer
|
||||
String tenantDomain = getTenantDomain();
|
||||
|
||||
// Check there is enough information to publish site activity.
|
||||
if (!siteId.equals(DEFAULT_SITE_ID))
|
||||
if (!siteId.equals(WebDAVHelper.EMPTY_SITE_ID))
|
||||
{
|
||||
SiteService siteService = getServiceRegistry().getSiteService();
|
||||
NodeRef documentLibrary = siteService.getContainer(siteId, SiteService.DOCUMENT_LIBRARY);
|
||||
|
@@ -240,7 +240,7 @@ public class PutMethod extends WebDAVMethod implements ActivityPostProducer
|
||||
|
||||
// If the mime-type determined by the repository is different
|
||||
// from the original specified in the request, update it.
|
||||
if (!m_strContentType.equals(writer.getMimetype()))
|
||||
if (m_strContentType == null || !m_strContentType.equals(writer.getMimetype()))
|
||||
{
|
||||
String oldMimeType = m_strContentType;
|
||||
m_strContentType = writer.getMimetype();
|
||||
@@ -347,7 +347,7 @@ public class PutMethod extends WebDAVMethod implements ActivityPostProducer
|
||||
String siteId = getSiteId();
|
||||
String tenantDomain = getTenantDomain();
|
||||
|
||||
if (siteId.equals(DEFAULT_SITE_ID))
|
||||
if (siteId.equals(WebDAVHelper.EMPTY_SITE_ID))
|
||||
{
|
||||
// There is not enough information to publish site activity.
|
||||
return;
|
||||
|
@@ -24,8 +24,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.ServiceRegistry;
|
||||
@@ -67,7 +65,7 @@ public class WebDAVHelper
|
||||
// Path seperator
|
||||
public static final String PathSeperator = "/";
|
||||
public static final char PathSeperatorChar = '/';
|
||||
private static final String DEFAULT_SITE_ID = null;
|
||||
public static final String EMPTY_SITE_ID = "";
|
||||
|
||||
// Logging
|
||||
private static Log logger = LogFactory.getLog("org.alfresco.webdav.protocol");
|
||||
@@ -659,11 +657,18 @@ public class WebDAVHelper
|
||||
{
|
||||
FileInfo fileInfo = getNodeForPath(method.getRootNodeRef(), method.getPath(), method.getServletPath());
|
||||
SiteInfo siteInfo = siteService.getSite(fileInfo.getNodeRef());
|
||||
if (siteInfo != null)
|
||||
{
|
||||
siteId = siteInfo.getShortName();
|
||||
}
|
||||
catch (FileNotFoundException error)
|
||||
else
|
||||
{
|
||||
siteId = DEFAULT_SITE_ID;
|
||||
throw new RuntimeException("Node is not contained by a site: " + method.getPath());
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
siteId = EMPTY_SITE_ID;
|
||||
}
|
||||
return siteId;
|
||||
}
|
||||
|
@@ -86,8 +86,6 @@ import org.xml.sax.SAXException;
|
||||
*/
|
||||
public abstract class WebDAVMethod
|
||||
{
|
||||
protected static final String DEFAULT_SITE_ID = "";
|
||||
|
||||
// Log output
|
||||
|
||||
protected static Log logger = LogFactory.getLog("org.alfresco.webdav.protocol");
|
||||
|
Reference in New Issue
Block a user