Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320162 - E4CommandProcessor.createBinding catch IllegalArgumentException which is never thrown
Summary: E4CommandProcessor.createBinding catch IllegalArgumentException which is neve...
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 0.9   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 1.0 RC3   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-17 07:58 EDT by Thomas Schindl CLA
Modified: 2010-07-20 08:27 EDT (History)
2 users (show)

See Also:
tom.schindl: review+
remy.suen: review+


Attachments
Move the IAE catch v01 (2.41 KB, patch)
2010-07-19 20:37 EDT, Paul Webster CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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