Community
Participate
Working Groups
Create a new TreeItem with another item as parent and an invalid index. According to the javadoc we should throw an exception in this case. To be added to testConstructor: try { new TreeItem( item, SWT.NONE, 5 ); fail( "No exception thrown for illegal index argument" ); } catch( IllegalArgumentException e ) { }
Created attachment 153250 [details] First draft I changed the logic of TreeItem( Tree ,TreeItem, style, index ). The constructor throws an IAE if the index is not valid. Valid arguments are all values between 0 and the number of Items in the parent (inclusive). In the old version, -1 was a valid argument and an indicator to add the created TreeItem at the end of the parent's array. In this Patch, an IAE is thrown if index == -1, too. I used the SWT implementation of TreeItem as a guide for valid arguments. In that implementation, -1 throws an IAE, and the highest valid index argument is parent.getItemCount().
Applied patch to CVS HEAD