Community
Participate
Working Groups
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 Build Identifier: 20090619-0625 There is no check for null pointer in AbstractEditPartViewer.addSelectionChangedListener(ISelectionChangedListener listener). If I add the null listener there is no exception raised. But after that the AbstractEditPartViewer.fireSelectionChanged() method works wrong, because there is no any protection against null pointer exception inside. Thus the firing of selection listeners is stopped, after the null listener is reached. Reproducible: Always Steps to Reproduce: /* * here I get a graphical * viewer (any implementation for org.eclipse.gef.GraphicalViewer, * viewer is inheritor of org.eclipse.gef.ui.parts.AbstractEditPartViewer) */ GraphicalViewer viewer = ... ; /* * here I create changes listener * */ ISelectionChangedListener listener = ...; /* * here I assign the null listener, * no exception is raised */ viewer.addSelectionListener(null); /* * here I assign the null listener, * no exception is raised */ viewer.addSelectionListener(null); /* * here I assign the null listener, * no exception is raised */ viewer.addSelectionListener(null); /* * here I assign the null listener, * no exception is raised */ viewer.addSelectionListener(listener); /* * last listener will never be executed in * the current AbstractEditPartViewer.fireSelectionChanged() implementation * */
(In reply to comment #0) > If I add the null listener there is no exception raised. > But after that the AbstractEditPartViewer.fireSelectionChanged() method works > wrong, because there is no any protection against null pointer exception > inside. Thus the firing of selection listeners is stopped, after the null > listener is reached. I am guessing there is some reason why you cannot simply not add the null listener?