When an ICopyFileArea could be null?
Hi,
I've a plain java extension which set some jazz user properties and then perform a check-in. Everything it is ok if I work with elements that belong to an eclipse project, but when I set properties on a project I've some problem.
During the ICheckInOperation I get a NullPointerException because
ICopyFileArea cfa = CopyFileAreaManager.instance.getCopyFileAreaForPath(sbox.getRoot());
seems to be null. I don't know how this object is used, but does anybody know what can cause this behaviour?
Thanks,
Michele.
2 answers
The manager doesn't know about a CFA at that path. Have you registered the sandbox before making that call? It likely works in Eclipse because RTC automatically registers sandboxes on startup.
The CFAManager is marked as internal, so you should avoid using it if possible. Can you use the ISharingManager instead? Since our APIs aren't well defined, the command line interface would be an even better choice (if possible).
I found out that the problem is in version 4 SDK and is related to the implementation of IRepositoryResolver that seems buggy or not so right.
As I already have an ITeamRepository (obtained using the login functions) I ovverride the resolver method:
private IRepositoryResolver resolver = new IRepositoryResolver() {
public ITeamRepository getRepoFor(String uri, UUID id) {
// Return the repository to be used
return repo;
}
};
So, if I use this resolver in the getCheckinOperation method it runs correctly.
Michele.
Comments
Michele Pegoraro
Apr 05 '13, 9:11 a.m.I still have this problem. The thing is that I don't use directly CFA, but when I try to use ICheckInOperation it gives me a NPE because the CFA is null. I've find out that I could resolve this problem deleting and reloading the workspace using scmtools before to run another check-in. So it seems that after running an ICheckInOperation the workspace becomes instable. Is there any way to refresh some metadata in order to use it again without reload it?
Evan Hughes
JAZZ DEVELOPER Apr 05 '13, 9:13 a.m.Have you tried the approach mentioned in the first question? (ie use ISharingManager.getSandbox() to ensure the sandbox has been registered)