It's all about the answers!

Ask a question

Can we deliver .zip file as a changeset in RTC SCM instead of unzipping the contents


Jazzuser user (681050) | asked Jul 19 '17, 12:56 a.m.

Hello All,

We have a usecase wherein, we need to deliver a given .zip file as a changeset, instead of unzipping and delivering the files.

Is it possible to deliver .zip file as it is ?
Request you to assist on this.

Thanks


Comments
Donald Nong commented Jul 19 '17, 2:43 a.m. | edited Jul 24 '17, 5:49 a.m.

That's interesting. It works as is for me.

I'm curious how the .zip files get unzipped automatically in your environment?


Jazzuser user commented Jul 21 '17, 12:35 a.m.

Thanks for the reply Donald.
I have taken the sample example from  : https://rsjazz.wordpress.com/2013/09/30/delivering-change-sets-and-baselines-to-a-stream-using-the-plain-java-client-libraries/

However am getting the following exception when I have .zip as a child folder in my parent .zip folder.
Parent.zip
     sample.txt
     child.zip

Here it is working fine for sample.txt. but exception for child.zip

Why is this issue happening ? Please suggest on this :( Thanks

Exception :


Jazzuser user commented Jul 21 '17, 12:36 a.m.

com.ibm.team.repository.common.TeamRepositoryException: Input length = 1
    at com.ibm.team.scm.client.content.BasicVersionedContentManager$StreamLengthUtility.run(BasicVersionedContentManager.java:239)
    at com.ibm.team.scm.client.content.BasicVersionedContentManager.storeContent(BasicVersionedContentManager.java:313)
    at com.ibm.team.filesystem.client.internal.content.FileContentManager.storeContent(FileContentManager.java:306)
    at com.bosch.rtc.scm.mkstortcmigrator.ArchiveToSCMExtractor.extractFile(ArchiveToSCMExtractor.java:202)
    at com.bosch.rtc.scm.mkstortcmigrator.ArchiveToSCMExtractor.extract(ArchiveToSCMExtractor.java:157)
    at com.bosch.rtc.scm.mkstortcmigrator.ArchiveToSCMExtractor.extractFileToComponent(ArchiveToSCMExtractor.java:114)
    at com.bosch.rtc.scm.mkstortcmigrator.MksToRtcMigrator.main(MksToRtcMigrator.java:58)
Caused by: java.nio.charset.MalformedInputException: Input length = 1
    at java.nio.charset.CoderResult.throwException(CoderResult.java:281)


1
Donald Nong commented Jul 21 '17, 1:42 a.m.

Sorry, I'm not familiar with these codes. As you're following Ralph's sample, you should really seek help from @rschoon.


Jazzuser user commented Jul 24 '17, 1:40 a.m. | edited Jul 24 '17, 5:47 a.m.

@Donald Nong,
request you to assist on how you are able to checkin the .zip file in your case.
Thanks


1
Donald Nong commented Jul 24 '17, 2:41 a.m.

I was not aware that you're using API when I replied. Basically I was testing a completely different use case. You can ignore all I said in this post.


Jazzuser user commented Jul 24 '17, 3:56 a.m.

thanks for the reply Donald.

showing 5 of 7 show 2 more comments

Accepted answer


permanent link
Ralph Schoon (63.3k33646) | answered Jul 21 '17, 2:55 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Yes, you can check in and deliver a zip file like any other type of file using the Java API.

Jazzuser user selected this answer as the correct answer

Comments
Jazzuser user commented Jul 21 '17, 4:46 a.m. | edited Jul 24 '17, 5:49 a.m.

but am getting the above mentioned exception when executing this below code from the sample link
             IFileContentManager contentManager = FileSystemCore
                     .getContentManager(fTeamRepository);
             IFileContent storedzipContent = contentManager.storeContent(
                     IFileContent.ENCODING_UTF_8,
                     FileLineDelimiter.LINE_DELIMITER_PLATFORM,
                     new VersionedContentManagerByteArrayInputStreamPovider(
                             contents.toByteArray()), null, fMonitor);

What could have gone wrong ?

I have a  child zipped folder  within the main zip folder(input to the RTC). 
This exception is thrown for  child zipped folder.


Ralph Schoon commented Jul 21 '17, 5:46 a.m. | edited Jul 24 '17, 5:48 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER


IFileContent.ENCODING_UTF_8: The zip file is not a text file but rather a binary, so this encoding stuff does not seem to make sense. Maybe there is something with binary?
FileLineDelimiter.LINE_DELIMITER_PLATFORM: The zip file is not a text file but rather a binary, so this line delimiter stuff does not seem to make sense. Maybe there is something with binary?

Looking at the declaration of com.ibm.team.filesystem.client.IFileContentManager.storeContent(String, FileLineDelimiter, AbstractVersionedContentManagerInputStreamProvider, ContentHash, IProgressMonitor) in the SDK shows:

@param characterEncoding
                 the character encoding of the bytes being sent, the format is
    
            specified in {@link IFileContent#getCharacterEncoding()} This value
                 is used by the HTTP server; it is <em>not</em> verified, and
    
            providing an incorrect value for this <em>may</em> result in
                 uncaught incorrect behavior.  The character encoding is used
    
            when performing validation/translation of line endings, so it
                 should be an encoding available on the server.  It
    
            does not need to be supplied when storing binary data (i.e.
     *            {@link FileLineDelimiter#LINE_DELIMITER_NONE}).

Searching in the SDK for how storeContent is used shows this example:

storeContent(null, FileLineDelimiter.LINE_DELIMITER_NONE, .............


Jazzuser user commented Jul 24 '17, 8:30 a.m.

Thanks Ralph :) this worked for me :)

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.