com.ibm.team.scm.common.ComponentNotInWorkspaceException
com.ibm.team.scm.common.ComponentNotInWorkspaceException
I am posting a fileto SCM by JAVA API
Until now, there was no problem, but this error occurred when the component name was incorrect.
An error has been issued that the component has been locked. However, we have unlocked all the components. However, the error persists. Does anyone know about this error?
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
IFileContentManager contentManager = FileSystemCore
.getContentManager(teamRepository);
IFileContent storedzipContent = contentManager.storeContent(
IFileContent.ENCODING_UTF_8,
FileLineDelimiter.LINE_DELIMITER_PLATFORM,
new VersionedContentManagerByteArrayInputStreamPovider(
contents.toByteArray()), null, monitor);
if (!storedzipContent.sameContent(aFile.getContent()))
{
IFileItem fileWorkingCopy = (IFileItem) aFile.getWorkingCopy();
fileWorkingCopy.setContent(storedzipContent);
Collection col = (Collection)Collections.singletonList( workspaceConne.configurationOpFactory().save(fileWorkingCopy));
workspaceConne.commit(changeSetHandle, col, monitor);
IConfiguration configuration = workspaceConne.configuration(component);
exctractToComponentBaseline(teamRepository, workspaceConne, myStream, component, strZipFilePath,
workItemId, monitor, changeSetHandle, configuration,
MYName ,systemName, planTargetName, modelCodeName,confidentialName,destinationName, shitukaName);
Accepted answer
A ComponentNotInWorkspaceException usually is a case where the component you are trying to perform operations against (ex: check-in to, or deliver to) does not exist in the repository workspace (or stream) that you are trying to work against.
Ex:
-The component did exist in the repository workspace, but was later removed.
-The component perhaps had it's visibility updated such that the user can no longer see it, and perhaps the code being used is is considering this a 'component not in workspace' case.
-Your code is retrieving/using the wrong component Ex: If you are trying to get a component by name (not at all recommended when writing plain-Java code) if could happen that someone else in the repository created a component with the same name... and in this case finding a component based on the name is not reliable. You should always build up an IComponentHandle using the components itemId (UUD) which will NEVER change, that way you can ensure you are always working against the same component going forward.
-The other possibility is you are also geting the wrong repository workspace (one that also doesn't have the component) (again, it's normally recommended to use the workspace itemId (UUID) to ensure you are working against the same repo workspace).
-Your snippets do now show how you are getting the repository workspace, or the component, so it's hard to give suggestions around this.
-You should also give a snippet of the stack trace error, as it might help narrow down where the issue is happening (devs might be able to provide insight around this)
-The other possibility is you are also geting the wrong repository workspace (one that also doesn't have the component) (again, it's normally recommended to use the workspace itemId (UUID) to ensure you are working against the same repo workspace).
-Your snippets do now show how you are getting the repository workspace, or the component, so it's hard to give suggestions around this.
-You should also give a snippet of the stack trace error, as it might help narrow down where the issue is happening (devs might be able to provide insight around this)
Comments
Kodac Hasubo
Mar 06 '22, 8:39 p.m.