ItemNotFoundException when trying to compute a file path (the request item is absent from configuration)
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);
}
IComponentHandle componentHandle = changeset.getComponent(); IConfiguration iConfig = workspaceConnection.configuration(componentHandle);
workspaceManager.findWorkspacesContainingChangeset(changeSet, wsc, Integer.MAX_VALUE, monitor);</pre>
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>
One answer
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.
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jan 31 '18, 5:52 a.m.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
Jan 31 '18, 6:48 a.m.I updated my question. I am trying to figure out when this can happen?