Buggy code:
public class TableColumn extends Item { Table parent ; String displayText = "" ; int width ; boolean moveable ; boolean resizable = true ; int sort = SWT . NONE ; String toolTipText ; public TableColumn ( Table parent , int style ) { } public TableColumn ( Table parent , int style , int index ) { } public void addControlListener ( ControlListener listener ) { } public void addSelectionListener ( SelectionListener listener ) { } static Table checkNull ( Table table ) { } static int checkStyle ( int style ) { } protected void checkSubclass ( ) { } void computeDisplayText ( GC gc ) { int availableWidth = ( width ) - ( 2 * ( parent . getHeaderPadding ( ) ) ) ; if ( ( image ) != null ) { availableWidth -= image . getBounds ( ) . width ; availableWidth -= Table . MARGIN_IMAGE ; } if ( ( sort ) != ( SWT . NONE ) ) { availableWidth -= parent . arrowBounds . width ; availableWidth -= Table . MARGIN_IMAGE ; } String text = this . text ; int textWidth = gc . textExtent ( text , DRAW_MNEMONIC ) . x ; if ( textWidth <= availableWidth ) { displayText = text ; return ; } int ellipsisWidth = gc . stringExtent ( ELLIPSIS ) . x ; availableWidth -= ellipsisWidth ; if ( availableWidth <= 0 ) { displayText = Table . ELLIPSIS ; return ; } <START_BUG> int index = availableWidth // ( gc . getFontMetrics ( ) . getAverageCharWidth ( ) ) ; <END_BUG> textWidth = gc . textExtent ( text . substring ( 0 , index ) , DRAW_MNEMONIC ) . x ; if ( availableWidth == textWidth ) { displayText = ( text . substring ( 0 , index ) ) + ( Table . ELLIPSIS ) ; return ; } if ( availableWidth < textWidth ) { do { index -- ; if ( index < 0 ) { displayText = Table . ELLIPSIS ; return ; } text = text . substring ( 0 , index ) ; textWidth = gc . textExtent ( text , DRAW_MNEMONIC ) . x ; } while ( availableWidth < textWidth ) ; displayText = text + ( Table . ELLIPSIS ) ; return ; } while ( textWidth < availableWidth ) { index ++ ; textWidth = gc . textExtent ( text . substring ( 0 , index ) , DRAW_MNEMONIC ) . x ; } displayText = ( text . substring ( 0 , ( index - 1 ) ) ) + ( Table . ELLIPSIS ) ; } public void dispose ( ) { } void dispose ( boolean notifyParent ) { } public int getAlignment ( ) { } int getContentWidth ( GC gc , boolean useDisplayText ) { } int getIndex ( ) { } public boolean getMoveable ( ) { } int getOrderIndex ( ) { } public Table getParent ( ) { } int getPreferredWidth ( ) { } public boolean getResizable ( ) { } public String getToolTipText ( ) { } public int getWidth ( ) { } int getX ( ) { } public void pack ( ) { } void paint ( GC gc ) { } public void removeControlListener ( ControlListener listener ) { } public void removeSelectionListener ( SelectionListener listener ) { } public void setAlignment ( int alignment ) { } public void setImage ( Image value ) { } public void setMoveable ( boolean moveable ) { } public void setResizable ( boolean value ) { } void setSortDirection ( int value ) { } public void setText ( String value ) { } public void setToolTipText ( String string ) { } public void setWidth ( int value ) { } void updateFont ( GC gc ) { } void updateWidth ( GC gc ) { } }

Fix:
int index = Math . min ( ( availableWidth // ( gc . getFontMetrics ( ) . getAverageCharWidth ( ) ) ) , text . length ( ) ) ;