Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 294606 - [Combo] IndexOutOfBounds for wrong arguments
Summary: [Combo] IndexOutOfBounds for wrong arguments
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.3 M4   Edit
Assignee: Dominik Ebert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-09 09:36 EST by Benjamin Muskalla CLA
Modified: 2009-12-04 06:00 EST (History)
2 users (show)

See Also:


Attachments
Final draft (2.76 KB, patch)
2009-11-24 08:16 EST, Dominik Ebert CLA
ruediger.herrmann: iplog+
Details | Diff
Wrong attachment for this bug - please delete (2.26 KB, text/plain)
2009-11-25 03:05 EST, Dominik Ebert CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Muskalla CLA 2009-11-09 09:36:19 EST
Call Combo#remove(int,int) with arguments out of bounds. We should throw an IAE exception in this case as stated in the Javadoc.

  public void testRemoveOutOfRange() {
    Display display = new Display();
    Shell shell = new Shell( display, SWT.NONE );
    final Combo combo = new Combo( shell, SWT.NONE );
    combo.add( "test" );
    combo.add( "test1" );
    combo.add( "test2" );
    try {
      combo.remove( 0, 100 );
      fail("No exception thrown for illegal index argument");
    } catch (IllegalArgumentException e) {
      // expected
    }
  }
Comment 1 Dominik Ebert CLA 2009-11-24 08:16:12 EST
Created attachment 152943 [details]
Final draft

I implemented that the method Combo#remove( int, int ) throws an IllegalArgumentException ( SWT.ERROR_INVALID_RANGE, as described in the Javadoc comment ) when getting invalid arguments.

I used the test method above but added some more test cases.
Comment 2 Dominik Ebert CLA 2009-11-25 03:05:30 EST
Created attachment 153038 [details]
Wrong attachment for this bug - please delete

I'm sorry, i uploaded the wrong patch. This should be the right one.
Comment 3 Rüdiger Herrmann CLA 2009-12-04 05:59:23 EST
Applied patch to CVS HEAD