Buggy code:
public class CopyResourceElementsOperation extends MultiOperation implements SuffixConstants { protected ArrayList fCreatedElements ; protected Map fDeltasPerProject = new HashMap ( 1 ) ; protected DOMFactory fFactory ; protected ArrayList fRenamedCompilationUnits = null ; public CopyResourceElementsOperation ( IJavaElement [ ] resourcesToCopy , IJavaElement destContainer , boolean force ) { } public CopyResourceElementsOperation ( IJavaElement [ ] resourcesToCopy , IJavaElement [ ] destContainers , boolean force ) { } private IResource [ ] collectResourcesOfInterest ( IPackageFragment source ) throws JavaModelException { } private boolean createNeededPackageFragments ( IContainer sourceFolder , IPackageFragmentRoot root , String newFragName , boolean moveFolder ) throws JavaModelException { } private JavaElementDelta getDeltaFor ( IJavaProject javaProject ) { } protected String getMainTaskName ( ) { } protected void prepareDeltas ( IJavaElement sourceElement , IJavaElement destinationElement , boolean isMove ) { } private void processCompilationUnitResource ( ICompilationUnit source , IPackageFragment dest ) throws JavaModelException { } protected void processDeltas ( ) { } protected void processElement ( IJavaElement element ) throws JavaModelException { } protected void processElements ( ) throws JavaModelException { } private void processPackageFragmentResource ( IPackageFragment source , IPackageFragmentRoot root , String newName ) throws JavaModelException { try { String newFragName = ( newName == null ) ? source . getElementName ( ) : newName ; IPackageFragment newFrag = root . getPackageFragment ( newFragName ) ; IResource [ ] resources = collectResourcesOfInterest ( source ) ; boolean shouldMoveFolder = ( isMove ( ) ) && ( ! ( newFrag . getResource ( ) . exists ( ) ) ) ; IFolder srcFolder = ( ( IFolder ) ( source . getResource ( ) ) ) ; IPath destPath = newFrag . getPath ( ) ; if ( shouldMoveFolder ) { if ( srcFolder . getFullPath ( ) . isPrefixOf ( destPath ) ) { shouldMoveFolder = false ; } else { IResource [ ] members = srcFolder . members ( ) ; for ( int i = 0 ; i < ( members . length ) ; i ++ ) { if ( ( members [ i ] ) instanceof IFolder ) { shouldMoveFolder = false ; break ; } } } } boolean containsReadOnlySubPackageFragments = createNeededPackageFragments ( ( ( IContainer ) ( source . getParent ( ) . getResource ( ) ) ) , root , newFragName , shouldMoveFolder ) ; <START_BUG> boolean sourceIsReadOnly = source . isReadOnly ( ) ; <END_BUG> if ( shouldMoveFolder ) { if ( sourceIsReadOnly ) { srcFolder . setReadOnly ( false ) ; } srcFolder . move ( destPath , fForce , true , getSubProgressMonitor ( 1 ) ) ; if ( sourceIsReadOnly ) { srcFolder . setReadOnly ( true ) ; } this . setAttribute ( JavaModelOperation . HAS_MODIFIED_RESOURCE_ATTR , JavaModelOperation . TRUE ) ; } else { if ( ( resources . length ) > 0 ) { if ( isRename ( ) ) { if ( ! ( destPath . equals ( source . getPath ( ) ) ) ) { moveResources ( resources , destPath ) ; } } else if ( isMove ( ) ) { for ( int i = 0 , max = resources . length ; i < max ; i ++ ) { IResource destinationResource = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . findMember ( destPath . append ( resources [ i ] . getName ( ) ) ) ; if ( destinationResource != null ) { if ( fForce ) { deleteResource ( destinationResource , IResource . KEEP_HISTORY ) ; } else { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Util . bind ( "status.nameCollision" , destinationResource . getFullPath ( ) . toString ( ) ) ) ) ; } } } moveResources ( resources , destPath ) ; } else { for ( int i = 0 , max = resources . length ; i < max ; i ++ ) { IResource destinationResource = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . findMember ( destPath . append ( resources [ i ] . getName ( ) ) ) ; if ( destinationResource != null ) { if ( fForce ) { deleteResource ( destinationResource , IResource . KEEP_HISTORY ) ; } else { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . NAME_COLLISION , Util . bind ( "status.nameCollision" , destinationResource . getFullPath ( ) . toString ( ) ) ) ) ; } } } copyResources ( resources , destPath ) ; } } } boolean isEmpty = true ; if ( ! ( newFrag . getElementName ( ) . equals ( source . getElementName ( ) ) ) ) { for ( int i = 0 ; i < ( resources . length ) ; i ++ ) { if ( resources [ i ] . getName ( ) . endsWith ( SuffixConstants . SUFFIX_STRING_java ) ) { ICompilationUnit cu = newFrag . getCompilationUnit ( resources [ i ] . getName ( ) ) ; IDOMCompilationUnit domCU = fFactory . createCompilationUnit ( cu . getSource ( ) , cu . getElementName ( ) ) ; if ( domCU != null ) { updatePackageStatement ( domCU , newFragName ) ; IBuffer buffer = cu . getBuffer ( ) ; if ( buffer == null ) continue ; String bufferContents = buffer . getContents ( ) ; if ( bufferContents == null ) continue ; String domCUContents = domCU . getContents ( ) ; String cuContents = null ; if ( domCUContents != null ) { cuContents = org . eclipse . jdt . internal . core . Util . normalizeCRs ( domCU . getContents ( ) , bufferContents ) ; } else { cuContents = bufferContents ; } buffer . setContents ( cuContents ) ; cu . save ( null , false ) ; } } } } if ( isMove ( ) ) { updateReadOnlyPackageFragmentsForMove ( ( ( IContainer ) ( source . getParent ( ) . getResource ( ) ) ) , root , newFragName , sourceIsReadOnly ) ;

Fix:
boolean sourceIsReadOnly = srcFolder . isReadOnly ( ) ;