Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

98073: Merged 5.0.N (5.0.2) to HEAD-BUG-FIX (5.1/Cloud)
      97984: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.2)
         97763: Merged DEV to V4.2-BUG-FIX
          96388: MNT-13183 : Folder accessed through WebDAV is empty when a document is locked through CIFS access
           Detect "AlfrescoLockKeeperImpl" and then create new LockInfo object. 
          97572: MNT-13183 : Folder accessed through WebDAV is empty when a document is locked through CIFS access
           Added marker for webdav lock. Added new junit test.
          97725: MNT-13183 : Folder accessed through WebDAV is empty when a document is locked through CIFS access
           Corrected some code. 


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@98102 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-02-26 07:46:57 +00:00
parent f7b7a8c2bd
commit 7802d4d1dc
3 changed files with 48 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
* Copyright (C) 2005-2015 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -40,6 +40,8 @@ public class LockInfoImpl implements Serializable, LockInfo
{
private static final long serialVersionUID = 1L;
public static final String ADDINFO_WEBDAV_MARKER = "WebDAV_LockInfo";
// Exclusive lock token
private String exclusiveLockToken = null;
@@ -264,20 +266,29 @@ public class LockInfoImpl implements Serializable, LockInfo
{
throw new RuntimeException("Unable to generate JSON for " + toString(), e);
}
return json;
return ADDINFO_WEBDAV_MARKER + ":" + json;
}
public static LockInfo fromJSON(String json)
{
ObjectMapper objectMapper = new ObjectMapper();
try
if (json != null && json.startsWith(ADDINFO_WEBDAV_MARKER))
{
LockInfo lockInfo = objectMapper.readValue(json, LockInfoImpl.class);
return lockInfo;
try
{
json = json.substring(ADDINFO_WEBDAV_MARKER.length() + 1);
LockInfo lockInfo = objectMapper.readValue(json, LockInfoImpl.class);
return lockInfo;
}
catch (Throwable e)
{
throw new IllegalArgumentException("Unable to parse JSON from [" + json + "]", e);
}
}
catch (Throwable e)
else
{
throw new RuntimeException("Unable to parse JSON from [" + json + "]", e);
throw new IllegalArgumentException("Was not detected WEBDAV_LOCK marker.");
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2005-2012 Alfresco Software Limited.
* Copyright (C) 2005-2015 Alfresco Software Limited.
*
* This file is part of Alfresco
*
@@ -343,14 +343,16 @@ public class WebDAVLockServiceImpl implements WebDAVLockService
if (lockState != null)
{
String additionalInfo = lockState.getAdditionalInfo();
if (additionalInfo != null)
try
{
lockInfo = LockInfoImpl.fromJSON(additionalInfo);
}
else
catch (IllegalArgumentException e)
{
lockInfo = new LockInfoImpl();
}
lockInfo.setExpires(lockState.getExpires());
lockInfo.setOwner(lockState.getOwner());
}