Buggy code:
public class CumulativePatchTestCase extends AbstractTaskTestCase { @ Test public void testApplyCumulativePatch ( ) throws Exception { } @ Test public void testApplyCumulativePatchAndRollback ( ) throws Exception { File binDir = IoUtils . mkdir ( env . getInstalledImage ( ) . getJbossHome ( ) , "bin" ) ; String fileName = "standalone.sh" ; File standaloneShellFile = TestUtils . touch ( binDir , fileName ) ; TestUtils . dump ( standaloneShellFile , "original<seq2seq4repair_space>script<seq2seq4repair_space>to<seq2seq4repair_space>run<seq2seq4repair_space>standalone<seq2seq4repair_space>AS7" ) ; byte [ ] existingHash = HashUtils . hashFile ( standaloneShellFile ) ; String patchID = TestUtils . randomString ( ) ; String layerPatchID = TestUtils . randomString ( ) ; File patchDir = IoUtils . mkdir ( tempDir , patchID ) ; String moduleName = TestUtils . randomString ( ) ; ContentModification moduleAdded = ContentModificationUtils . addModule ( patchDir , layerPatchID , moduleName ) ; <START_BUG> ContentModification fileModified = ContentModificationUtils . modifyMisc ( patchDir , "updated<seq2seq4repair_space>script" , standaloneShellFile , "bin" , "standalone.sh" ) ; <END_BUG> InstalledIdentity installedIdentity = loadInstalledIdentity ( ) ; Patch patch = PatchBuilder . create ( ) . setPatchId ( patchID ) . setDescription ( TestUtils . randomString ( ) ) . setIdentity ( new org . jboss . as . patching . metadata . impl . IdentityImpl ( installedIdentity . getIdentity ( ) . getName ( ) , installedIdentity . getIdentity ( ) . getVersion ( ) ) ) . setUpgrade ( ( ( productConfig . getProductVersion ( ) ) + "-CP1" ) ) . addElement ( new PatchElementImpl ( layerPatchID ) . setProvider ( new org . jboss . as . patching . metadata . impl . PatchElementProviderImpl ( PatchInfo . BASE , "1.0.1" , false ) ) . setNoUpgrade ( ) . addContentModification ( moduleAdded ) ) . addContentModification ( fileModified ) . build ( ) ; TestUtils . createPatchXMLFile ( patchDir , patch ) ; File zippedPatch = TestUtils . createZippedPatchFile ( patchDir , patchID ) ; Identity identityBeforePatch = loadInstalledIdentity ( ) . getIdentity ( ) ; PatchingResult result = executePatch ( zippedPatch ) ; PatchingAssert . assertPatchHasBeenApplied ( result , patch ) ; PatchingAssert . assertFileExists ( standaloneShellFile ) ; PatchingAssert . assertFileContent ( fileModified . getItem ( ) . getContentHash ( ) , standaloneShellFile ) ; InstalledIdentity updatedInstalledIdentity = loadInstalledIdentity ( ) ; File modulePatchDirectory = updatedInstalledIdentity . getLayers ( ) . get ( 0 ) . loadTargetInfo ( ) . getDirectoryStructure ( ) . getModulePatchDirectory ( layerPatchID ) ; PatchingAssert . assertDirExists ( modulePatchDirectory ) ; PatchingAssert . assertDefinedModule ( modulePatchDirectory , moduleName , moduleAdded . getItem ( ) . getContentHash ( ) ) ; PatchingResult rollbackResult = rollback ( patchID ) ; TestUtils . tree ( env . getInstalledImage ( ) . getJbossHome ( ) ) ; PatchingAssert . assertPatchHasBeenRolledBack ( rollbackResult , identityBeforePatch ) ; PatchingAssert . assertFileExists ( standaloneShellFile ) ; PatchingAssert . assertFileContent ( existingHash , standaloneShellFile ) ; } @ Test public void testApplyCumulativePatchThenOneOffPatch ( ) throws Exception { } @ Test public void testApplyCumulativePatchThenOneOffPatchThenRollbackCumulativePatch ( ) throws Exception { } @ Test public void testInvalidateOneOffPatches ( ) throws Exception { } }

Fix:
ContentModification fileModified = ContentModificationUtils . modifyMisc ( patchDir , patchID , "updated<seq2seq4repair_space>script" , standaloneShellFile , "bin" , "standalone.sh" ) ;