Buggy code:
public class ToolItem extends Item { NSView view ; NSButton button ; int width = ToolItem . DEFAULT_SEPARATOR_WIDTH ; ToolBar parent ; Image hotImage ; Image disabledImage ; String toolTipText ; Control control ; boolean selection ; static final int DEFAULT_WIDTH = 24 ; static final int DEFAULT_HEIGHT = 22 ; static final int DEFAULT_SEPARATOR_WIDTH = 6 ; static final int INSET = 3 ; static final int ARROW_WIDTH = 5 ; public ToolItem ( ToolBar parent , int style ) { } public ToolItem ( ToolBar parent , int style , int index ) { } int accessibilityAttributeValue ( int id , int sel , int arg0 ) { } public void addSelectionListener ( SelectionListener listener ) { } static int checkStyle ( int style ) { } protected void checkSubclass ( ) { } Point computeSize ( ) { } void createHandle ( ) { } NSAttributedString createString ( ) { <START_BUG> NSAttributedString attribStr = parent . createString ( text , null , parent . foreground , CENTER , true ) ; <END_BUG> attribStr . autorelease ( ) ; return attribStr ; } void deregister ( ) { } void destroyWidget ( ) { } void drawImageWithFrameInView ( int id , int sel , int image , NSRect rect , int view ) { } void drawWidget ( int id , NSGraphicsContext context , NSRect rect ) { } void enableWidget ( boolean enabled ) { } public Rectangle getBounds ( ) { } void setClipRegion ( float x , float y ) { } public Control getControl ( ) { } public Image getDisabledImage ( ) { } boolean getDrawing ( ) { } public boolean getEnabled ( ) { } public Image getHotImage ( ) { } public ToolBar getParent ( ) { } public boolean getSelection ( ) { } public String getToolTipText ( ) { } public int getWidth ( ) { } public boolean isEnabled ( ) { } boolean isDrawing ( ) { } int menuForEvent ( int id , int sel , int theEvent ) { } void mouseDown ( int id , int sel , int theEvent ) { } void mouseUp ( int id , int sel , int theEvent ) { } void mouseDragged ( int id , int sel , int theEvent ) { } void rightMouseDown ( int id , int sel , int theEvent ) { } void rightMouseUp ( int id , int sel , int theEvent ) { } void rightMouseDragged ( int id , int sel , int theEvent ) { } void otherMouseDown ( int id , int sel , int theEvent ) { } void otherMouseUp ( int id , int sel , int theEvent ) { } void otherMouseDragged ( int id , int sel , int theEvent ) { } void register ( ) { } public void removeSelectionListener ( SelectionListener listener ) { } void releaseParent ( ) { } void releaseHandle ( ) { } void releaseWidget ( ) { } void selectRadio ( ) { } void sendSelection ( ) { } void setBounds ( int x , int y , int width , int height ) { } public void setControl ( Control control ) { } public void setEnabled ( boolean enabled ) { } public void setDisabledImage ( Image image ) { } public void setHotImage ( Image image ) { } public void setImage ( Image image ) { } boolean setRadioSelection ( boolean value ) { } public void setSelection ( boolean selected ) { } public void setText ( String string ) { } public void setToolTipText ( String string ) { } void setVisible ( boolean visible ) { } public void setWidth ( int width ) { } String tooltipText ( ) { } void updateImage ( boolean layout ) { } }

Fix:
NSAttributedString attribStr = parent . createString ( text , null , parent . foreground , CENTER , true , true ) ;