06-01-2014 07:49 AM
org.apache.chemistry.opencmis.commons.exceptions.CmisStorageException: Expected 654502 bytes but retrieved 0 bytes!
at org.alfresco.opencmis.AlfrescoCmisServiceImpl.copyToTempFile(AlfrescoCmisServiceImpl.java:2812)
at org.alfresco.opencmis.AlfrescoCmisServiceImpl.checkIn(AlfrescoCmisServiceImpl.java:2029)
if (document.isVersionSeriesCheckedOut()) {
LOG.info("Cancelling checkout of document with id {}.", document.getId());
document.cancelCheckOut();
}
document.delete();
06-01-2014 08:36 AM
CmisStorageException: Expected 654502 bytes but retrieved 0 bytes!
by specifying content stream length when construct ContentStream like below
File file = new File("C:\\userguide.pdf");
InputStream fis = new FileInputStream(file);
DataInputStream dis = new DataInputStream(fis);
byte[] bytes = new byte[(int) file.length()];
dis.readFully(bytes);
ContentStream contentStream = new ContentStreamImpl(file
.getAbsolutePath(), BigInteger.valueOf(bytes.length), "application/pdf",
new ByteArrayInputStream(bytes));
02-01-2017 01:35 PM
CmisStorageException: Expected 654502 bytes but retrieved 0 bytes!
I'm not a java person, but did a quick review of the code (since we're seeing similar issues while under load) --
There appear to be multiple things going on... I would suggest a need for some serious code reviews:
Inside "createTempFile()" -- are multiple issues, that based upon LOAD will personify themselves differently.
private File copyToTempFile(ContentStream contentStream)
{
if (contentStream == null)
{
return null;
}
File result = null;
try
{
result = TempFileProvider.createTempFile(contentStream.getStream(), "cmis", "content");
}
catch (Exception e)
{
throw new CmisStorageException("Unable to store content: " + e.getMessage(), e);
}
if ((contentStream.getLength() > -1) && (result == null || contentStream.getLength() != result.length()))
{
removeTempFile(result);
throw new CmisStorageException("Expected " + contentStream.getLength() + " bytes but retrieved " +
(result == null ? -1 :result.length()) + " bytes!");
}
return result;
}
02-01-2017 01:41 PM
For one, the removeTempFile(result); makes result.length() always be zero. Therefore the exception message is misleading. Perhaps we ought to be seeing "Expected 654502 bytes but retrieved 654500 bytes!"
*Update*
I patched the war to retain the resultLength
if ((contentStream.getLength() > -1) && (result == null || contentStream.getLength() != result.length()))
{
long resultLength = result.length();
removeTempFile(result);
throw new CmisStorageException("Expected " + contentStream.getLength() + " bytes but retrieved " +
(result == null ? -1 :resultLength) + " bytes!")
}
and it still says "... retrieved 0 bytes!".
I did packet captures on both the cmis client and server sides, and they both show that the posts are garbled. It looks like the cmis client is generating garbled payloads, and the server cannot parse the content, resulting in zero-length content streams.
06-01-2014 08:57 AM
06-01-2014 10:19 AM
d.refresh();
or object checking status only maintented in client side.
document.checkIn(**);
document.refresh();// reload the object
if (document.isVersionSeriesCheckedOut()) {
LOG.info("Cancelling checkout of document with id {}.", document.getId());
document.cancelCheckOut();
}
document.delete();
06-01-2014 11:36 AM
06-02-2014 05:34 AM
08-07-2019 12:55 AM
Dear kayne zhang,
I've disable cache for session as your instruction, but in case of multi file upload concurrent, error still miss. To slove this problem, I must to sleep 2s (if multi file upload concurrent). So, do you have other solution? Please give me some advise?
06-01-2014 02:48 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.