It's all about the answers!

Ask a question

Exception while retrieving IFileItem content


Daniele Menon (2643) | asked Oct 23 '09, 11:06 a.m.
Hi,

I'm trying to retrieve the content of a IFileItem with the following code:

IVersionable versionable = ...


IFileItem fileItem = (IFileItem) versionable;
IFileItemHandle fileHandle = (IFileItemHandle) fileItem.getItemHandle();
IFileContent content = fileItem.getContent();
contentManager.retrieveContent(fileHandle, content, outputStream, null);


But I obtain the following exception:

Exception in thread "main" java.lang.IllegalArgumentException

at com.ibm.team.scm.client.content.BasicVersionedContentManager.retrieveContentStream(BasicVersionedContentManager.java:1114)
at com.ibm.team.filesystem.client.internal.content.FileContentManager.retrieveContentStream(FileContentManager.java:160)
at ...


What is the problem?

Alternatively, could I retrieve a versioned file directly and save it?

Thank you.

One answer



permanent link
Andrew Hoo (1.0k1) | answered Oct 29 '09, 9:24 a.m.
JAZZ DEVELOPER
I'm not 100% sure on this, but try passing in "fileItem" as opposed to
fileHandle (aka, fileItem.getItemHandle()) into the contentManager call.
FileItem extends FileItemHandle. State information might be getting lost
in the getItemHandle() call.



On Fri, 23 Oct 2009 11:08:01 -0400, kostja79
<daniele> wrote:

Hi,

I'm trying to retrieve the content of a IFileItem with the following
code:

IVersionable versionable = ...

IFileItem fileItem = (IFileItem) versionable;
IFileItemHandle fileHandle = (IFileItemHandle)
fileItem.getItemHandle();
IFileContent content = fileItem.getContent();
contentManager.retrieveContent(fileHandle, content, outputStream,
null);

But I obtain the following exception:

Exception in thread "main"
java.lang.IllegalArgumentException
at
com.ibm.team.scm.client.content.BasicVersionedContentManager.retrieveContentStream(BasicVersionedContentManager.java:1114)
at
com.ibm.team.filesystem.client.internal.content.FileContentManager.retrieveContentStream(FileContentManager.java:160)
at ...


What is the problem?

Alternatively, could I retrieve a versioned file directly and save
it?

Thank you.



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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.