| Summary: | Potential NPEs in JDT UI code | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Deepak Azad <deepakazad> |
| Component: | UI | Assignee: | Markus Keller <markus.kell.r> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | daniel_megert |
| Version: | 3.8 | ||
| Target Milestone: | 3.8 M5 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
I've fixed the the CUDP. There was never a problem to get an NPE since the field is initialized once and never set later.
Moving to Markus for the MoveInstanceMethodWizard: I guess
fProcessor.setInlineDelegator(!fLeaveDelegateCheckBox.getSelection());
fProcessor.setRemoveDelegator(!fLeaveDelegateCheckBox.getSelection());
not only it has to be protected against 'null' but also be updated when the selection of 'fLeaveDelegateCheckBox' changes.
MoveInstanceMethodWizard: Just removed the two lines, since DelegateUIHelper.generateLeaveDelegateCheckbox(..) already installs a callback to update the refactoring when the check box is toggled. |
master branch Potential null pointer access: The field fGeneratedAnnotations may be null at this location CompilationUnitDocumentProvider.java /org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor line 744 The code does look wrong to me private void stopCollectingProblems() { if (fGeneratedAnnotations != null) removeAnnotations(fGeneratedAnnotations, true, true); fGeneratedAnnotations.clear(); //warning } Potential null pointer access: The field fLeaveDelegateCheckBox may be null at this location MoveInstanceMethodWizard.java /org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring line 259 Similar code pattern as above fLeaveDelegateCheckBox= //something if (fLeaveDelegateCheckBox != null) { // lots of code here } fProcessor.setInlineDelegator(!fLeaveDelegateCheckBox.getSelection()); //warning fProcessor.setRemoveDelegator(!fLeaveDelegateCheckBox.getSelection());