Uploaded image for project: 'Chemistry (Retired)'
  1. Chemistry (Retired)
  2. CMIS-411

Wrong use of the ContentStreamImpl in the Creating a document example

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • OpenCMIS 0.5.0
    • site&docs
    • None

    Description

      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:

      // content
      byte[] content = "Hello World!".getBytes();
      InputStream stream = new ByteArrayInputStream(content);
      ContentStream contentStream = new ContentStreamImpl(name, content.length, "text/plain", stream);
      

      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:

      // content
      byte[] content = "Hello World!".getBytes();
      InputStream stream = new ByteArrayInputStream(content);
      ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(content), "text/plain", stream);
      

      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.

      Attachments

        Activity

          People

            fmui Florian Müller
            piergiorgiolucidi@gmail.com Piergiorgio Lucidi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified