Wrong use of the ContentStreamImpl in the Creating a document example
---------------------------------------------------------------------
Key: CMIS-411
URL: https://issues.apache.org/jira/browse/CMIS-411
Project: Chemistry
Issue Type: Bug
Components: site&docs
Reporter: Piergiorgio Lucidi
Priority: Minor
In the Creating a document example available at the following page:
http://chemistry.apache.org/java/examples/example-create-update.html
I found this snippet dedicated to create the content stream:
{code}
// content
byte[] content = "Hello World!".getBytes();
InputStream stream = new ByteArrayInputStream(content);
ContentStream contentStream = new ContentStreamImpl(name, content.length,
"text/plain", stream);
{code}
But I think that it is wrong, trying to execute the snippet on OpenCMIS 0.4.0,
the right way to create a content is the following:
{code}
// content
byte[] content = "Hello World!".getBytes();
InputStream stream = new ByteArrayInputStream(content);
ContentStream contentStream = new ContentStreamImpl(name, new
BigInteger(content), "text/plain", stream);
{code}
The second argument of the ContentStreamImpl constructor must be a BigInteger,
in the example shown in the website content.length return an int value that
can't be used correctly.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira