Community
Participate
Working Groups
Build Identifier: M20090917-0800 I'm calling getProvider in the early stages of eclipse startup and while I don't necessarily expect it to return anything but null, what I get is an NPE when the call is made. In particular the traceback shows it is trying to exec this line: org.eclipse.core.internal.resources.Resource.getPersistentProperty(Resource.java:1067) Which is here: public String getPersistentProperty(QualifiedName key) throws CoreException { checkAccessibleAndLocal(DEPTH_ZERO); return getPropertyManager().getProperty(this, key); } And it turns out that getProperyManager is returning as null... This is being called in a RefreshProvider context so it is running from refreshprovider's installMonitor method at startup. The doc does appear to state that getPers.Prop could throw a CoreException or return null. It happens every time in the sense that if I make this call when 1) refresh workspace is enabled, and I've just started the workbench and then do the provider check (which of course forces installMonitor to be called during the early phases of the startup... but the project is open and available. Reproducible: Always Steps to Reproduce: 1. create a refresh provider plugin 2. in installMonitor add RepositoryProvider.getProvider((IProject)resource); // or whatever you need to get a project root 3. add some project to your workspace 4. turn on refresh. 5. restart workbench. ---> that's when I get the npe on the call.
I realize that it's possible that full initialization hasn't occured, but in our case, it would be exceedingly helpful to be able to make this call for a repo provider at the time installMonitor is being called. The fact that installMonitor is called so early and in the main thread does have some important performance implications which I'm trying to resolve.
This sounds more like a Resources issue, moving to their inbox for comment.
It can be easily reproduced with the steps from comment 0. A refresh provider with #installMonitor as below public IRefreshMonitor installMonitor(IResource resource, IRefreshResult result){ try { resource.getProject().getPersistentProperty(new QualifiedName("q", "n")); } catch (CoreException e) { e.printStackTrace(); } return null; } will throw NPE on workbench restart when auto-refresh is enabled.
This looks pretty straightforward to fix -- just move the propertymanager higher in the Workspace#startup.
Well, I think the deeper problem is that the refresh provider is being initialized too early in startup while the resource plugin is still in the middle of activation.
Created attachment 212066 [details] Patch https://git.eclipse.org/r/#/c/5244/
Szymon, please review.
Fixed with http://git.eclipse.org/c/platform/eclipse.platform.resources.git/commit/?id=3e5707eaf8edead76e9345b1cf92313789bc8b45.