| Summary: | [Help][Context] NPE in EscapeUtils when activating Dynamic Help | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Beth Tibbitts <beth> | ||||
| Component: | User Assistance | Assignee: | Chris Goldthorpe <cgold> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | cgold | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | 3.7 M5 | ||||||
| Hardware: | PC | ||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Beth Tibbitts
Looking at the stack trace ContextHelpPart.formatHelpContext(ContextHelpPart.java:611) is sbuf.append(EscapeUtils.escapeSpecialChars(link.getLabel())); the code is creating the hyperlinks to the related topics. For some reason the label for this related topic is null. I can eliminate the NPE easily enough but there is still something going wrong to cause the label to be null. I tried omitting the label attribute in the contexts.xml file but that did not reproduce the problem. If the application is using a context provider that could explain why the label is null. It sounds as though you are in an editor when you select context help, is that true. One possibility is that the CDT editor has a context provider and in this case the context is returning a null label. The help system should probably detect this situation and prevent the NPE, which is easy enough to do but it seems that would not completely fix the underlying problem of a context with null label being created. Targeting Eclipse 3.7 to eliminate the NPE. Yes when I imported some eclipse source I could tell that the label was null. I couldn't figure out why. Now I realize that a line of my code setting the label somehow got accidentally erased. Sorry about that. Mea culpa. But you're right, if the implementor doesn't supply it, perhaps you should fail a bit more gracefully, perhaps substituting "help label not supplied" or something so there is something to click on in the help view and it should be immediately apparent My apologies, but it was fun digging. Created attachment 186790 [details]
Patch
This patch suppresses the NPE, instead the links still show but the description is "null". I had thought of not displaying the link if the label is null but that would mean the error could go undetected, this way the developer should be able to figure out what is happening and fix it.
Patch committed to HEAD, Fixed +1 :-) |