Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320162

Summary: E4CommandProcessor.createBinding catch IllegalArgumentException which is never thrown
Product: [Eclipse Project] e4 Reporter: Thomas Schindl <tom.schindl>
Component: UIAssignee: Paul Webster <pwebster>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: pwebster, remy.suen
Version: 0.9Flags: tom.schindl: review+
remy.suen: review+
Target Milestone: 1.0 RC3   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Move the IAE catch v01 none

Description Thomas Schindl CLA 2010-07-17 07:58:39 EDT
The code looks like this:

TriggerSequence sequence = null;
		try {
			sequence = bs.createSequence(keySequence);
		} catch (IllegalArgumentException ex) {
			// the sequence is not complete
			Activator.trace(Policy.DEBUG_MENUS, "failed to create: " + binding, ex); //$NON-NLS-1$
			return null;
		}

But when looking at code in KeySequence.getInstance the only Exceptions thrown are:
* NPE
* ParseException (catched in BindingServiceImpl)

I guess the code should catch the NPE and not the never thrown IAE
Comment 1 Thomas Schindl CLA 2010-07-17 10:20:53 EDT
The IllegalArgumentException has to be catched though some rows below:

!SESSION 2010-07-17 16:19:29.622 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_20
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=de_DE
Framework arguments:  -product org.eclipse.e4.demo.contacts.product
Command-line arguments:  -product org.eclipse.e4.demo.contacts.product -data /Users/tomschindl/Documents/ecipse_ws/e4_clean_2/../runtime-contacts.product -dev file:/Users/tomschindl/Documents/ecipse_ws/e4_clean_2/.metadata/.plugins/org.eclipse.pde.core/contacts.product/dev.properties -os macosx -ws cocoa -arch x86_64 -consoleLog

!ENTRY org.eclipse.osgi 4 0 2010-07-17 16:19:34.113
!MESSAGE Application error
!STACK 1
java.lang.IllegalArgumentException: Cannot bind to an incomplete key sequence
	at org.eclipse.jface.bindings.keys.KeyBinding.<init>(KeyBinding.java:76)
	at org.eclipse.e4.ui.bindings.internal.BindingServiceImpl.createBinding(BindingServiceImpl.java:71)
Comment 2 Paul Webster CLA 2010-07-17 19:04:45 EDT
(In reply to comment #0)
> But when looking at code in KeySequence.getInstance the only Exceptions thrown
> are:
> * NPE
> * ParseException (catched in BindingServiceImpl)
> 

The constructor for KeySequence throws IAE

PW
Comment 3 Thomas Schindl CLA 2010-07-18 03:37:05 EDT
(In reply to comment #2)
> (In reply to comment #0)
> > But when looking at code in KeySequence.getInstance the only Exceptions thrown
> > are:
> > * NPE
> > * ParseException (catched in BindingServiceImpl)
> > 
> 
> The constructor for KeySequence throws IAE
> 

Yes but this one is caught in getInstance() and transformed into an ParseException
Comment 4 Paul Webster CLA 2010-07-19 20:37:39 EDT
Created attachment 174693 [details]
Move the IAE catch v01
Comment 5 Remy Suen CLA 2010-07-19 21:04:12 EDT
(In reply to comment #4)
> Created an attachment (id=174693) [details]
> Move the IAE catch v01

Makes sense to me.
Comment 6 Paul Webster CLA 2010-07-20 08:27:44 EDT
Released