Buggy code:
public class MessageBox extends Dialog { int button ; String message = "" ; public MessageBox ( Shell parent ) { } public MessageBox ( Shell parent , int style ) { } int activate ( int widget , int client , int call ) { } static int checkStyle ( int style ) { } int createHandle ( int parentHandle , int [ ] argList ) { } public String getMessage ( ) { } public int open ( ) { String string = title ; if ( ( string . length ( ) ) == 0 ) string = "<seq2seq4repair_space>" ; byte [ ] buffer = Converter . wcsToMbcs ( null , string , true ) ; int xmStringPtr = OS . XmStringParseText ( buffer , 0 , XmFONTLIST_DEFAULT_TAG , XmCHARSET_TEXT , null , 0 , 0 ) ; int dialogStyle = OS . XmDIALOG_MODELESS ; if ( ( ( style ) & ( SWT . PRIMARY_MODAL ) ) != 0 ) dialogStyle = OS . XmDIALOG_PRIMARY_APPLICATION_MODAL ; if ( ( ( style ) & ( SWT . APPLICATION_MODAL ) ) != 0 ) dialogStyle = OS . XmDIALOG_FULL_APPLICATION_MODAL ; if ( ( ( style ) & ( SWT . SYSTEM_MODAL ) ) != 0 ) dialogStyle = OS . XmDIALOG_SYSTEM_MODAL ; <START_BUG> if ( ( ( parent ) != null ) && ( dialogStyle == ( OS . XmDIALOG_MODELESS ) ) ) { <END_BUG> dialogStyle = OS . XmDIALOG_PRIMARY_APPLICATION_MODAL ; } boolean defaultPos = parent . isVisible ( ) ; int [ ] argList = new int [ ] { OS . XmNnoResize , 1 , OS . XmNresizePolicy , OS . XmRESIZE_NONE , OS . XmNdialogStyle , dialogStyle , OS . XmNdialogTitle , xmStringPtr , OS . XmNdefaultPosition , defaultPos ? 1 : 0 } ; int parentHandle = parent . shellHandle ; int dialog = createHandle ( parentHandle , argList ) ; if ( dialog == 0 ) error ( ERROR_NO_HANDLES ) ; OS . XmStringFree ( xmStringPtr ) ; setMessage ( dialog ) ; setButtons ( dialog ) ; Callback callback = new Callback ( this , "activate" , 3 ) ; int address = callback . getAddress ( ) ; if ( address == 0 ) SWT . error ( ERROR_NO_MORE_CALLBACKS ) ; OS . XtAddCallback ( dialog , XmNokCallback , address , XmDIALOG_OK_BUTTON ) ; OS . XtAddCallback ( dialog , XmNcancelCallback , address , XmDIALOG_CANCEL_BUTTON ) ; OS . XtAddCallback ( dialog , XmNhelpCallback , address , XmDIALOG_HELP_BUTTON ) ; if ( ! defaultPos ) { OS . XtRealizeWidget ( dialog ) ; int [ ] argList1 = new int [ ] { OS . XmNwidth , 0 , OS . XmNheight , 0 } ; OS . XtGetValues ( dialog , argList1 , ( ( argList1 . length ) // 2 ) ) ; Monitor monitor = parent . getMonitor ( ) ; Rectangle bounds = monitor . getBounds ( ) ; int x = ( bounds . x ) + ( ( ( bounds . width ) - ( argList1 [ 1 ] ) ) // 2 ) ; int y = ( bounds . y ) + ( ( ( bounds . height ) - ( argList1 [ 3 ] ) ) // 2 ) ; int [ ] argList2 = new int [ ] { OS . XmNx , x , OS . XmNy , y } ; OS . XtSetValues ( dialog , argList2 , ( ( argList2 . length ) // 2 ) ) ; } OS . XtManageChild ( dialog ) ; Display display = parent . display ; while ( ( OS . XtIsRealized ( dialog ) ) && ( OS . XtIsManaged ( dialog ) ) ) if ( ! ( display . readAndDispatch ( ) ) ) display . sleep ( ) ; if ( OS . XtIsRealized ( dialog ) ) OS . XtDestroyWidget ( dialog ) ; callback . dispose ( ) ; if ( ( ( style ) & ( ( ( SWT . YES ) | ( SWT . NO ) ) | ( SWT . CANCEL ) ) ) == ( ( ( SWT . YES ) | ( SWT . NO ) ) | ( SWT . CANCEL ) ) ) { if ( ( button ) == ( OS . XmDIALOG_OK_BUTTON ) ) return SWT . YES ; if ( ( button ) == ( OS . XmDIALOG_CANCEL_BUTTON ) ) return SWT . NO ; return SWT . CANCEL ; } if ( ( ( style ) & ( ( SWT . YES ) | ( SWT . NO ) ) ) == ( ( SWT . YES ) | ( SWT . NO ) ) ) { return ( button ) == ( OS . XmDIALOG_OK_BUTTON ) ? SWT . YES : SWT . NO ; } if ( ( ( style ) & ( ( SWT . OK ) | ( SWT . CANCEL ) ) ) == ( ( SWT . OK ) | ( SWT . CANCEL ) ) ) { return ( button ) == ( OS . XmDIALOG_OK_BUTTON ) ? SWT . OK : SWT . CANCEL ; } if ( ( ( style ) & ( SWT . OK ) ) == ( SWT . OK ) ) return SWT . OK ; if ( ( ( style ) & ( ( SWT . RETRY ) | ( SWT . CANCEL ) ) ) == ( ( SWT . RETRY ) | ( SWT . CANCEL ) ) ) { return ( button ) == ( OS . XmDIALOG_OK_BUTTON ) ? SWT . RETRY : SWT . CANCEL ; }

Fix:
if ( dialogStyle == ( OS . XmDIALOG_MODELESS ) ) {