mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
CMIS: added code to check if the full document stream has been retrieved. It cannot catch all cases but a few.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31552 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -2952,6 +2952,7 @@ public class AlfrescoCmisService extends AbstractCmisService
|
||||
}
|
||||
|
||||
int bufferSize = 40 * 1014;
|
||||
long count = 0;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -2966,6 +2967,7 @@ public class AlfrescoCmisService extends AbstractCmisService
|
||||
while ((i = in.read(buffer)) > -1)
|
||||
{
|
||||
out.write(buffer, 0, i);
|
||||
count += i;
|
||||
}
|
||||
|
||||
in.close();
|
||||
@@ -2973,9 +2975,17 @@ public class AlfrescoCmisService extends AbstractCmisService
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
removeTempFile(tempFile);
|
||||
throw new CmisStorageException("Unable to store content: " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
if (contentStream.getLength() > -1 && contentStream.getLength() != count)
|
||||
{
|
||||
removeTempFile(tempFile);
|
||||
throw new CmisStorageException("Expected " + contentStream.getLength() + " bytes but retrieved " + count
|
||||
+ "bytes!");
|
||||
}
|
||||
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user