Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to download log file from build result through plain java client library

 As title, when I have a IBuildResult implemented object through querying, how do I download the log file from it?

 

1 vote


Accepted answer

Permanent link
code in one of my tools

ITeamBuildClient buildClient = (ITeamBuildClient) RepoServer.getClientLibrary(ITeamBuildClient.class);
// get build result
...
// use build result to get log contribution content object and data
IBuildResultContribution[] ibrcl =buildClient.getBuildResultContributions(br, IBuildResultContribution.LOG_EXTENDED_CONTRIBUTION_ID, null);
for(IBuildResultContribution ibrc : ibrcl)
{
String s=getContent(ibrc.getExtendedContributionData(), RepoServer.contentManager());
}
// worker routine to get the string from the content object
    private static String getContent(IContent ic, IContentManager icm)
    {
        // make an output stream for the content manager
        OutputStream os = new ByteArrayOutputStream();
        // get the content of the content object.
        try
        {
            if (ic != null)
            {
                icm.retrieveContent(ic, os, null);
                return os.toString();
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        return null;
    }


Lee John selected this answer as the correct answer

2 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Mar 13 '15, 5:24 a.m.

Question was seen: 2,588 times

Last updated: Mar 13 '15, 8:05 a.m.

Related questions
Confirmation Cancel Confirm