Buggy code:
public class DropTarget extends Widget { private Control control ; private Listener controlListener ; private Transfer [ ] transferAgents = new Transfer [ 0 ] ; private DragUnderEffect effect ; private TransferData selectedDataType ; private int selectedOperation ; private int keyOperation = - 1 ; private long dragOverStart ; private Runnable dragOverHeartbeat ; private DNDEvent dragOverEvent ; private static DropTarget CurrentDropTarget = null ; private static final String DROPTARGETID = "DropTarget" ; private static final int DRAGOVER_HYSTERESIS = 50 ; private static Callback DragTrackingHandler ; private static Callback DragReceiveHandler ; public DropTarget ( Control control , int style ) { } static int checkStyle ( int style ) { } private static int DragReceiveHandler ( int theWindow , int handlerRefCon , int theDrag ) { } private static int DragTrackingHandler ( int message , int theWindow , int handlerRefCon , int theDrag ) { } private static DropTarget FindDropTarget ( int theWindow , int theDrag ) { } public void addDropListener ( DropTargetListener listener ) { } protected void checkSubclass ( ) { } private int dragReceiveHandler ( int theWindow , int handlerRefCon , int theDrag ) { } private int dragTrackingHandler ( int message , int theWindow , int handlerRefCon , int theDrag ) { } public Control getControl ( ) { } private int getOperationFromKeyState ( int theDrag ) { } public Transfer [ ] getTransfer ( ) { } public void notifyListeners ( int eventType , Event event ) { } private void onDispose ( ) { } private int opToOsOp ( int operation ) { } private int osOpToOp ( int osOperation ) { } public void removeDropListener ( DropTargetListener listener ) { } private boolean setEventData ( int theDrag , DNDEvent event ) { if ( theDrag == 0 ) return false ; int style = getStyle ( ) ; int [ ] outActions = new int [ 1 ] ; OS . GetDragAllowableActions ( theDrag , outActions ) ; int operations = ( osOpToOp ( outActions [ 0 ] ) ) & style ; if ( operations == ( DND . DROP_NONE ) ) return false ; int operation = getOperationFromKeyState ( theDrag ) ; keyOperation = operation ; if ( operation == ( DND . DROP_DEFAULT ) ) { if ( ( style & ( DND . DROP_DEFAULT ) ) == 0 ) { operation = ( ( operations & ( DND . DROP_MOVE ) ) != 0 ) ? DND . DROP_MOVE : DND . DROP_NONE ; } } else { if ( ( operation & operations ) == 0 ) operation = DND . DROP_NONE ; } short [ ] numItems = new short [ 1 ] ; OS . CountDragItems ( theDrag , numItems ) ; int [ ] flavors = new int [ 10 ] ; int index = - 1 ; for ( short i = 0 ; i < ( numItems [ 0 ] ) ; i ++ ) { int [ ] theItemRef = new int [ 1 ] ; OS . GetDragItemReferenceNumber ( theDrag , ( ( short ) ( i + 1 ) ) , theItemRef ) ; short [ ] numFlavors = new short [ 1 ] ; OS . CountDragItemFlavors ( theDrag , theItemRef [ 0 ] , numFlavors ) ; int [ ] theType = new int [ 1 ] ; <START_BUG> for ( int j = 0 ; j < ( numFlavors . length ) ; j ++ ) { <END_BUG> theType [ 0 ] = 0 ; if ( ( OS . GetFlavorType ( theDrag , theItemRef [ 0 ] , ( ( short ) ( j + 1 ) ) , theType ) ) == ( OS . noErr ) ) { boolean unique = true ; for ( int k = 0 ; k < ( flavors . length ) ; k ++ ) { if ( ( flavors [ k ] ) == ( theType [ 0 ] ) ) { unique = false ; break ; } } if ( unique ) { if ( index == ( ( flavors . length ) - 1 ) ) { int [ ] temp = new int [ ( flavors . length ) + 10 ] ; System . arraycopy ( flavors , 0 , temp , 0 , flavors . length ) ; flavors = temp ; } flavors [ ( ++ index ) ] = theType [ 0 ] ; } } } } if ( index == ( - 1 ) ) return false ; TransferData [ ] dataTypes = new TransferData [ index + 1 ] ; index = - 1 ; for ( int i = 0 ; i < ( dataTypes . length ) ; i ++ ) { if ( ( flavors [ i ] ) != 0 ) { TransferData data = new TransferData ( ) ; data . type = flavors [ i ] ; for ( int j = 0 ; j < ( transferAgents . length ) ; j ++ ) { if ( transferAgents [ j ] . isSupportedType ( data ) ) { dataTypes [ ( ++ index ) ] = data ; break ; } } } } if ( index == ( - 1 ) ) return false ; if ( index < ( ( dataTypes . length ) - 1 ) ) { TransferData [ ] temp = new TransferData [ index + 1 ] ; System . arraycopy ( dataTypes , 0 , temp , 0 , ( index + 1 ) ) ; dataTypes = temp ; } Point mouse = new Point ( ) ; OS . GetDragMouse ( theDrag , mouse , null ) ; event . widget = this ; event . x = mouse . h ; event . y = mouse . v ; event . time = ( ( int ) ( System . currentTimeMillis ( ) ) ) ;

Fix:
for ( int j = 0 ; j < ( numFlavors [ 0 ] ) ; j ++ ) {