| Summary: | NPE in org.eclipse.wst.server.ui.editor.ServerEditorPart.doSaveAs() causes JUnit failure | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [WebTools] WTP ServerTools | Reporter: | Steven Hung <sghung> | ||||
| Component: | wst.server | Assignee: | Steven Hung <sghung> | ||||
| Status: | RESOLVED FIXED | QA Contact: | Elson Yuen <eyuen7> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | thatnitind | ||||
| Version: | unspecified | ||||||
| Target Milestone: | 3.3.2 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| See Also: | https://git.eclipse.org/r/109091 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Steven Hung
Created attachment 210076 [details]
Patch v1.0
Overview of fix:
Added a null check for the commandManager and also handled other possible exceptions within the iterator for ServerEditorPageSectionFactories
Note: this JUnit issue does not occur on the R3_2_5 stream, since the doSaveAs() on this stream does not do anything. The issue occurs in R3_3, which is where these tests were run against.
Tests run:
1. Ensured ServerEditorCore.getServerEditorPageSectionFactories() would not return null, by hacking the code to return no results when checking for registry. This ensured that no null check is necessary for getting the iterator because an empty array would be returned
2. Ensured that when the commandManager is null, that the NPE was caught. This test was done by running the JUnit again, to ensure that it would not throw an NPE
3. Ensured that editors could be loaded successfully, by launching the server editor with Tomcat and verifying that the logic had not changed through the addition of the try/catch block and the NPE check
Steven, thanks for submitting the patch. Code released to 33M and HEAD. *** Bug 368731 has been marked as a duplicate of this bug. *** New Gerrit change created: https://git.eclipse.org/r/109091 |