It's all about the answers!

Ask a question

Getting IFileContent for > 32kb files?

Adrian Abraham (111) | asked Jul 02 '12, 10:29 a.m.
I'm trying to modify files in RTC, but I'm having trouble getting the IFileContent. I'm trying to get it as follows:

    final FileInputStream stream = ...;

    AbstractVersionedContentManagerInputStreamProvider streamProvider = new AbstractVersionedContentManagerInputStreamProvider() {
      public void dispose() throws IOException, TeamRepositoryException {}

      public InputStream getInputStream(int i) throws IOException, TeamRepositoryException { return stream; }

      public InputStream wrapInputStream(InputStream in) throws IOException, TeamRepositoryException { return in; }

    IFileContentManager fileContentManager = FileSystemCore.getContentManager(repo);
    IFileContent content =  fileContentManager.storeContent(
        encoding, // I've tried "UTF-8" and null
        delimiter,  // I've tried both PLATFORM and NONE

This works fine if the file is less than 32k. Above 32k, I get the following: CRJAZ0099I When accessing the URL "https://MYSERVER:9443/ccm/service/" the following HTTP error occurred: "Bad file descriptor"
Caused by: Bad file descriptor
    at Method)

What do I need to do to upload big files?

One answer

permanent link
Adrian Abraham (111) | answered Jul 02 '12, 4:01 p.m.
After a lot more poking at it, I've found that the following steps occur:
1) storeContent calls AVCMISP.getInputStream(1)
2) storeContent creates a byte array and reads the stream into it
2a) If the stream fits (< 32k), the byte array is wrapped in a stream and passed to AVCMISP.wrapInputStream(), and life is good
2b) If the stream doesn't fit, it's closed.
3b) AVCMISPgetInputStream(2) is called, passed to AVCMISP.wrapInputStream, and read from.

I was receiving "Bad file descriptor" because my getInputStream(2) returned the already-closed stream, and it was trying to read from it. Now, I'm opening 2 copies of the stream and I've rigged up getInputStream to return the different copies. It's really ugly, but everything seems to be working fine.

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.