chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "linzhixing (JIRA)" <>
Subject [jira] [Created] (CMIS-578) contentStream's length become null on setContentStream method
Date Sat, 13 Oct 2012 09:49:03 GMT
linzhixing created CMIS-578:

             Summary: contentStream's length become null on setContentStream method
                 Key: CMIS-578
             Project: Chemistry
          Issue Type: Bug
    Affects Versions: OpenCMIS 0.6.0
            Reporter: linzhixing

I'm developing a CMIS client and server. 

Creating a new document and uploading an attachment of a document both work almost fine,
but uploading has a problem. ContentStream of the attachemnt's length is 0!


//calss ObjectServiceImpl

 // send content
        HttpUtils.Response resp = put(url, contentStream.getMimeType(), headers, new HttpUtils.Output()
            public void write(OutputStream out) throws Exception {
                int b;
                byte[] buffer = new byte[4096];

                while ((b = > -1) {
                    out.write(buffer, 0, b);


//package org.apache.chemistry.opencmis.client.bindings.spi.http;
//class HttpUtils

public static Response invokePOST(UrlBuilder url, String contentType, Output writer, BindingSession
session) {
        return invoke(url, "POST", contentType, null, writer, session, null, null);

public static Response invokePUT(UrlBuilder url, String contentType, Map<String, String>
headers, Output writer,
BindingSession session) {
        return invoke(url, "PUT", contentType, headers, writer, session, null, null);

(*invokePUT method is executed when upgrading)


My server's code
public void setContentStream(CallContext callContext,
			Holder<String> objectId, boolean overwriteFlag,
			ContentStream contentStream) {
		String newAttachmentId = nodeService.createAttachment(
				millisToCalendar(System.currentTimeMillis()), contentStream);
		Content content = nodeService.get(Document.class, objectId.getValue());
		// TODO use overwriteFlag


Just before (A), the contentStream has non-zero length.
It is our specification that my server's code creates a new document for the attachement when
upgrading, anyway, when the debugger enterd into (B) method, contentStream already became
zero length.

When I create a new document with attached file(not upgrading), invokePOST method is executed
and contentStream has non-zero length even on my server's part. 

So, I guess it would not be a probelm of my developing product's behavior.
invokePUTmethod or such thing  has Content' length bug?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message