It's all about the answers!

Ask a question

ItemNotFoundException when trying to compute a file path (the request item is absent from configuration)


0
2
Shiva Tiwari (1717) | asked Jan 31 '18, 5:39 a.m.
edited Jun 04 '18, 10:57 a.m. by David Lafreniere (4.8k7)

 Hi I am using RTC Enterprise version 6.0.4 . I am trying to fetch full file paths of all the files in a changeset in this way :


IVersionableHandle filePathHandle = versionableHandle;
currentItem = versionableManager.fetchCompleteState(versionableHandle, monitor);
try {
 while (filePathHandle != null) {
   final String name = currentItem.getName();
   if (name != null & name.length() > 0) {
     filePath = name + File.separator + filePath;
   }
   filePathHandle = currentItem.getParent();
   if (filePathHandle != null) {
     //You have to switch from verManager.fetchCompleteState(versionableHandle, monitor) to
     // iconfig.fetchCompleteItem (versionableHandle, monitor) to avoid null state for folders.
      log.debug("To get the filePath for File:" + currentItem.getName() + " FilePath: " + filePath);
     currentItem = iConfig.fetchCompleteItem(filePathHandle, monitor);
   }
 }
 if (!filePath.isEmpty() && (versionableHandle instanceof IFileItemHandle)) {
   workingFileName = filePath.substring(0, filePath.length() - 1);
 }
I have seen mutliple links to fetch the full file path :






My code works well with file paths. I can retrieve file paths even in case of Rename/Move/ADD/DELETE. But for some of the fileItems I am getting this error:

com.ibm.team.repository.common.ItemNotFoundException: The request item is absent from configuration
 at com.ibm.team.scm.client.internal.ConnectionBasedClientConfigurationProxy.fetch(ConnectionBasedClientConfigurationProxy.java:401)
 at com.ibm.team.scm.client.internal.ConnectionBasedClientConfigurationProxy.fetchCompleteItem(ConnectionBasedClientConfigurationProxy.java:591)

I am not sure what is causing this .

I am retrieving IConfiguration object like this:

IComponentHandle componentHandle = changeset.getComponent();
IConfiguration iConfig = workspaceConnection.configuration(componentHandle);

Can you please point me out why for some of the filePaths I am getting temNotFoundException.
OR if there is any alternate solution to get the full file path if I don't use the IConfiguration iConfig object?

First I am fetching the WorkSpaceConnection which contains this changeset:
workspaceManager.findWorkspacesContainingChangeset(changeSet, wsc, Integer.MAX_VALUE, monitor);

</pre>

and then I am get the IConfig Object like this :
IConfiguration iConfig = workspaceConnection.configuration(componentHandle);

    </pre>
    <pre style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-family: Menlo; font-size: 9pt;">

I can even get the fileName using : IVersionable.getName() .. but problem is while retrieving full file path.

    </pre>
    <pre style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-family: Menlo; font-size: 9pt;">

Any use-case when this fileItem won't be present in IConfig ?

    </pre>
    <pre style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-family: Menlo; font-size: 9pt;">

Because as per my understanding if this changeset is present in workSpace means it should be present in IConfig as well ?

    </pre>
</div>




Comments
Ralph Schoon commented Jan 31 '18, 5:51 a.m. | edited Jan 31 '18, 5:52 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

The error message indicates that the item you are trying to get the path for IS NOT IN THE SELECTED CONFIGURATION. For whatever reason, that version of the item is not part of the component, its history/this baseline, its history. At least that is what I would think the error means. So if you can't even get the item, you can not expect to get its file path.


Shiva Tiwari commented Jan 31 '18, 6:22 a.m. | edited Jan 31 '18, 6:48 a.m.

I updated my question. I am trying to figure out when this can happen?

One answer



permanent link
David Lafreniere (4.8k7) | answered Jun 04 '18, 10:55 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

I think this happens for files/folders that are deleted. It is true that the files (versionables) exist in a previous change set in history, but if the file itself, and all it's parent folders have been deleted, then in the 'current' configuration of the workspace the file and the parent folder will not exist, and thus there is no valid/known path for that versionable in the workspace you are using.

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.