Bug 206179 [Contributions] null pointer referenced is not caught when adding an action/item to menu in org.eclipse.jface.action.ContributionManager
If an error in ApplicationActionBarAdivosor-class occurs the application is just terminated, but does not throw an exception on console, even not in debug mode. Example: Save Action. When the save action is not created in the RCP's ActionBarAdvisor, but tried to be added to the menu the application is just terminated. A possible solution might be the modification of the both add-methods in org.eclipse.jface.action.ContributionManager: /* * (non-Javadoc) Method declared on IContributionManager. */ public void add(IAction action) { try{ add(new ActionContributionItem(action)); } catch(NullPointerException e){ ILog log = Platform.getLog(JFaceActivator.getBundle()); String message = "The action element pointed to null."; //$NON-NLS-1$ log.log(new Status(IStatus.ERROR, String.valueOf(JFaceActivator.getBundle().getBundleId()), message,e )); } } /* * (non-Javadoc) Method declared on IContributionManager. */ public void add(IContributionItem item) { try{ if (allowItem(item)) { contributions.add(item); itemAdded(item); } } catch(NullPointerException e){ ILog log = Platform.getLog(JFaceActivator.getBundle()); String message = "The item has a null-reference"; //$NON-NLS-1$ log.log(new Status(IStatus.ERROR, String.valueOf(JFaceActivator.getBundle().getBundleId()), message,e )); } }
bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionManager.java
itemAdded(item);
		}
	}
	/**
	 * Adds a contribution item to the start or end of the group with the given
	 * name.
	 * 
	 * @param groupName
	 *            the name of the group
	 * @param item
	 *            the contribution item
	 * @param append
	 *            <code>true</code> to add to the end of the group, and
	 *            <code>false</code> to add the beginning of the group
	 * @exception IllegalArgumentException
	 *                if there is no group with the given name
	 */
	private void addToGroup(String groupName, IContributionItem item,
			boolean append) {
		int i;
		Iterator items = contributions.iterator();
		for (i = 0; items.hasNext(); i++) {
			IContributionItem o = (IContributionItem) items.next();
			if (o.isGroupMarker()) {
				String id = o.getId();
				if (id != null && id.equalsIgnoreCase(groupName)) {
					i++;
					if (append) {
						for (; items.hasNext(); i++) {
							IContributionItem ci = (IContributionItem) items