| Summary: | RuntimeDelegate. setAttribute throwing NPE | ||
|---|---|---|---|
| Product: | [WebTools] WTP ServerTools | Reporter: | James Kingdon <jkingdon> |
| Component: | wst.server | Assignee: | wst.server <wst.server-inbox> |
| Status: | RESOLVED INVALID | QA Contact: | Angel Vera <arvera> |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Looks like the problem was that the client code needed to check for being passed a IRuntime or an IRuntimeWorkingCopy and create the working copy if necessary. |
Build Identifier: 3.2.0.v201005290030-377A88s73533E6K4C6E I'm working on an adopting product that uses RuntimeDelegate.setAttribute to associate data with a server runtime instance. We have reports where our code is failing in a manner consistent with the data not being stored in the instance. Once the IDE gets into this state it appears to fail every time and the problem is not solved by restarting the IDE. Unfortunately I have not been able to reproduce the problem locally. One user provided .log files that show the setAttribute method failing with NPE: !ENTRY org.eclipse.wst.common.project.facet.core 4 0 2010-07-07 07:24:06.750 !MESSAGE null !STACK 0 java.lang.NullPointerException at org.eclipse.wst.server.core.model.RuntimeDelegate.setAttribute(Unknown Source) Since the setAttribute method is a one-liner we can infer that the runtimeWC instance variable must be null org.eclipse.wst.server.core.model. RuntimeDelegate.setAttribute(String, String): protected final void setAttribute(String id, String value) { runtimeWC.setAttribute(id, value); } The runtimeWC instance variable looks to be set in the initialize method final void initialize(Runtime newRuntime, IProgressMonitor monitor) { runtime = newRuntime; if (runtime instanceof RuntimeWorkingCopy) runtimeWC = (RuntimeWorkingCopy) runtime; initialize(); } In my (working) environment I can see this method getting called and setting runtimeWC appropriately. I'd appreciate any guidance on how the RuntimeDelegate is initialized and why it might fail to be correctly initialized under some circumstances. Regards, James Reproducible: Always Steps to Reproduce: Once the failure occurs for a user it appears to be permanent (I've asked for them to try a new workspace to see if it is WS specific), but unfortunately I do not have a way of reproducing the problem.