Bug 68667 NPE in AddressBook example
RC4 - run the AddressBook example - File -> Open Address Book... --> opens a FileDialog - change the file filter in the dialog to * to show all files (assuming you're on a platform whose FileDialog shows this filter) - select some random file that has nothing to do with the AddressBook example, Open - will get the following NPE: java.lang.NullPointerException at org.eclipse.swt.examples.addressbook.AddressBook$RowComparator.compare(AddressBook.java:870) at java.util.Arrays.mergeSort(Arrays.java:1278) at java.util.Arrays.mergeSort(Arrays.java:1289) at java.util.Arrays.mergeSort(Arrays.java:1289) at java.util.Arrays.mergeSort(Arrays.java:1289) at java.util.Arrays.mergeSort(Arrays.java:1289) at java.util.Arrays.mergeSort(Arrays.java:1289) at java.util.Arrays.sort(Arrays.java:1219) at org.eclipse.swt.examples.addressbook.AddressBook.openAddressBook(AddressBook.java:326) at org.eclipse.swt.examples.addressbook.AddressBook.access$9(AddressBook.java:268) at org.eclipse.swt.examples.addressbook.AddressBook$9.widgetSelected(AddressBook.java:509) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:731) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2938) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2642) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:183) at org.eclipse.core.launcher.Main.run(Main.java:644) at org.eclipse.core.launcher.Main.main(Main.java:628)
examples/org.eclipse.swt.examples/src/org/eclipse/swt/examples/addressbook/AddressBook.java
/** 
	 * Adds a listener to handle enabling and disabling 
	 * some items in the Edit submenu.
	 */
	popUpMenu.addMenuListener(new MenuAdapter() {
		public void menuShown(MenuEvent e) {
			Menu menu = (Menu)e.widget;
			MenuItem[] items = menu.getItems();
			int count = table.getSelectionCount();
			items[2].setEnabled(count != 0); 
			items[3].setEnabled(count != 0); 
			items[4].setEnabled(copyBuffer != null); 
			items[5].setEnabled(count != 0); 
			items[7].setEnabled(table.getItemCount() != 0); 
		}
	});
	
	MenuItem item = new MenuItem(popUpMenu, SWT.CASCADE);
	item.setText(resAddressBook.getString("Pop_up_new"));
	item.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			newEntry();
		}
	});
	
	new MenuItem(popUpMenu, SWT.SEPARATOR);	
	
	
	item = new MenuItem(popUpMenu, SWT.CASCADE);
	item.setText(resAddressBook.getString("Pop_up_edit"));