Buggy code:
public Rectangle getClientArea ( ) { } public TableColumn getColumn ( int index ) { } public int getColumnCount ( ) { } public int [ ] getColumnOrder ( ) { } public TableColumn [ ] getColumns ( ) { } public int getGridLineWidth ( ) { } public int getHeaderHeight ( ) { } public boolean getHeaderVisible ( ) { } public TableItem getItem ( int index ) { } public TableItem getItem ( Point point ) { } public int getItemCount ( ) { } public int getItemHeight ( ) { } public TableItem [ ] getItems ( ) { } public boolean getLinesVisible ( ) { } public TableItem [ ] getSelection ( ) { } public int getSelectionCount ( ) { } public int getSelectionIndex ( ) { } public int [ ] getSelectionIndices ( ) { } public int getTopIndex ( ) { } int hitTestProc ( int browser , int id , int property , int theRect , int mouseRect ) { } void hookEvents ( ) { } public int indexOf ( TableColumn column ) { } public int indexOf ( TableItem item ) { } public boolean isSelected ( int index ) { } int itemDataProc ( int browser , int id , int property , int itemData , int setValue ) { } int itemNotificationProc ( int browser , int id , int message ) { } int kEventMouseDown ( int nextHandler , int theEvent , int userData ) { } int kEventTextInputUnicodeForKeyEvent ( int nextHandler , int theEvent , int userData ) { } void releaseWidget ( ) { } public void remove ( int index ) { } public void remove ( int start , int end ) { } public void remove ( int [ ] indices ) { } public void removeAll ( ) { } public void removeSelectionListener ( SelectionListener listener ) { } void resetVisibleRegion ( int control ) { } public void select ( int index ) { } public void select ( int start , int end ) { } public void select ( int [ ] indices ) { } void select ( int [ ] ids , int count , boolean clear ) { } public void selectAll ( ) { } void setBackground ( float [ ] color ) { } int setBounds ( int x , int y , int width , int height , boolean move , boolean resize , boolean events ) { } public void setColumnOrder ( int [ ] order ) { } void setFontStyle ( Font font ) { } public void setHeaderVisible ( boolean show ) { } public void setItemCount ( int count ) { checkWidget ( ) ; checkItems ( true ) ; count = Math . max ( 0 , count ) ; if ( count == ( itemCount ) ) return ; setRedraw ( false ) ; int [ ] top = new int [ 1 ] ; int [ ] left = new int [ 1 ] ; OS . GetDataBrowserScrollPosition ( handle , top , left ) ; DataBrowserCallbacks callbacks = new DataBrowserCallbacks ( ) ; OS . GetDataBrowserCallbacks ( handle , callbacks ) ; callbacks . v1_itemNotificationCallback = 0 ; OS . SetDataBrowserCallbacks ( handle , callbacks ) ; if ( count < ( itemCount ) ) { int index = count ; while ( index < ( itemCount ) ) { int [ ] id = new int [ ] { index + 1 } ; if ( ( OS . RemoveDataBrowserItems ( handle , kDataBrowserNoItem , id . length , id , 0 ) ) != ( OS . noErr ) ) { break ; } TableItem item = items [ index ] ; if ( item != null ) item . releaseResources ( ) ; index ++ ; } if ( index < ( itemCount ) ) error ( ERROR_ITEM_NOT_REMOVED ) ; } int length = Math . max ( 4 , ( ( ( count + 3 ) // 4 ) * 4 ) ) ; TableItem [ ] newItems = new TableItem [ length ] ; System . arraycopy ( items , 0 , newItems , 0 , Math . min ( count , itemCount ) ) ; items = newItems ; if ( ( ( style ) & ( SWT . VIRTUAL ) ) == 0 ) { <START_BUG> for ( int i = count ; i < ( itemCount ) ; i ++ ) { <END_BUG> items [ i ] = new TableItem ( this , SWT . NONE , i , false ) ; } } itemCount = count ; OS . AddDataBrowserItems ( handle , 0 , itemCount , null , kDataBrowserItemNoProperty ) ; callbacks . v1_itemNotificationCallback = display . itemNotificationProc ; OS . SetDataBrowserCallbacks ( handle , callbacks ) ; setRedraw ( true ) ; } void setItemHeight ( Image image ) { } public void setLinesVisible ( boolean show ) { } public void setRedraw ( boolean redraw ) { } boolean setScrollWidth ( TableItem item ) { } boolean setScrollWidth ( TableItem [ ] items , boolean set ) { } public void setSelection ( int index ) { } void setSelection ( int index , boolean notify ) { } public void setSelection ( int start , int end ) { } public void setSelection ( int [ ] indices ) { } public void setSelection ( TableItem [ ] items ) { } void setTableEmpty ( ) { } public void setTopIndex ( int index ) { } public void showColumn ( TableColumn column ) { } void showIndex ( int index ) { } public void showItem ( TableItem item ) { } public void showSelection ( ) { } int trackingProc ( int browser , int id , int property , int theRect , int startPt , int modifiers ) { } }

Fix:
for ( int i = itemCount ; i < count ; i ++ ) {