Buggy code:
public class ContentConflictsUnitTestCase extends AbstractTaskTestCase { @ Test public void testApply ( ) throws Exception { } @ Test public void testRollback ( ) throws Exception { final File binDir = createInstalledImage ( env , "consoleSlot" , productConfig . getProductName ( ) , productConfig . getProductVersion ( ) ) ; String patchID = randomString ( ) ; String patchElementId = randomString ( ) ; File patchDir = IoUtils . mkdir ( tempDir , patchID ) ; File baseModuleDir = IoUtils . newFile ( env . getInstalledImage ( ) . getModulesDir ( ) , Constants . SYSTEM , Constants . LAYERS , Constants . BASE ) ; String moduleConflictName = "module-conflict" ; File moduleConflictDir = createModule0 ( baseModuleDir , moduleConflictName ) ; ContentModification moduleConflictModified = ContentModificationUtils . modifyModule ( patchDir , patchElementId , moduleConflictDir , "new<seq2seq4repair_space>resource<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>module" ) ; String moduleNoConflictName = "module-no-conflict" ; File moduleNoConflictDir = createModule0 ( baseModuleDir , moduleNoConflictName ) ; ContentModification moduleNoConflictModified = ContentModificationUtils . modifyModule ( patchDir , patchElementId , moduleNoConflictDir , "new<seq2seq4repair_space>resource<seq2seq4repair_space>in<seq2seq4repair_space>the<seq2seq4repair_space>module" ) ; String fileConflictName = "file-conflict.txt" ; File conflictFile = touch ( binDir , fileConflictName ) ; dump ( conflictFile , "original<seq2seq4repair_space>script<seq2seq4repair_space>to<seq2seq4repair_space>run<seq2seq4repair_space>standalone<seq2seq4repair_space>AS7" ) ; ContentModification fileConflictModified = ContentModificationUtils . modifyMisc ( patchDir , patchID , "updated<seq2seq4repair_space>script" , conflictFile , "bin" , fileConflictName ) ; String fileNoConflictName = "file-no-conflict.txt" ; File noConflictFile = touch ( binDir , fileNoConflictName ) ; dump ( noConflictFile , "original<seq2seq4repair_space>script<seq2seq4repair_space>to<seq2seq4repair_space>run<seq2seq4repair_space>standalone<seq2seq4repair_space>AS7" ) ; ContentModification fileNoConflictModified = ContentModificationUtils . modifyMisc ( patchDir , patchID , "updated<seq2seq4repair_space>script" , noConflictFile , "bin" , fileNoConflictName ) ; File baseBundleDir = IoUtils . newFile ( env . getInstalledImage ( ) . getBundlesDir ( ) , Constants . SYSTEM , Constants . LAYERS , Constants . BASE ) ; String bundleConflictName = "bundle-conflict" ; File bundleConflictDir = createBundle0 ( baseBundleDir , bundleConflictName , "bundle<seq2seq4repair_space>content" ) ; ContentModification bundleConflictModified = ContentModificationUtils . modifyBundle ( patchDir , patchElementId , bundleConflictDir , "updated<seq2seq4repair_space>bundle<seq2seq4repair_space>content" ) ; String bundleNoConflictName = "bundle-no-conflict" ; File bundleNoConflictDir = createBundle0 ( baseBundleDir , bundleNoConflictName , "bundle<seq2seq4repair_space>content" ) ; ContentModification bundleNoConflictModified = ContentModificationUtils . modifyBundle ( patchDir , patchElementId , bundleNoConflictDir , "updated<seq2seq4repair_space>bundle<seq2seq4repair_space>content" ) ; Patch patch = PatchBuilder . create ( ) . setPatchId ( patchID ) . setDescription ( randomString ( ) ) . oneOffPatchIdentity ( productConfig . getProductName ( ) , productConfig . getProductVersion ( ) ) . getParent ( ) . addContentModification ( fileConflictModified ) . addContentModification ( fileNoConflictModified ) . oneOffPatchElement ( patchElementId , "base" , false ) . addContentModification ( moduleConflictModified ) . addContentModification ( moduleNoConflictModified ) . addContentModification ( bundleConflictModified ) . addContentModification ( bundleNoConflictModified ) . getParent ( ) . build ( ) ; createPatchXMLFile ( patchDir , patch , false ) ; File zippedPatch = createZippedPatchFile ( patchDir , patch . getPatchId ( ) ) ; CommandContext ctx = CommandContextFactory . getInstance ( ) . newCommandContext ( ) ; try { ctx . handle ( ( ( ( "patch<seq2seq4repair_space>apply<seq2seq4repair_space>" + ( zippedPatch . getAbsolutePath ( ) ) ) + "<seq2seq4repair_space>--distribution=" ) + ( env . getInstalledImage ( ) . getJbossHome ( ) ) ) ) ; } catch ( CommandLineException e ) { ctx . terminateSession ( ) ; fail ( ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>apply<seq2seq4repair_space>the<seq2seq4repair_space>patch:<seq2seq4repair_space>" + e ) ) ; } dump ( conflictFile , "conflicting<seq2seq4repair_space>change" ) ; createModule0 ( baseModuleDir , moduleConflictName , "oops" ) ; createBundle0 ( baseBundleDir , bundleConflictName , "oops" ) ; try { <START_BUG> ctx . handle ( ( ( ( "patch<seq2seq4repair_space>rollback<seq2seq4repair_space>--patch-id=" + patchID ) + "<seq2seq4repair_space>--distribution=" ) + ( env . getInstalledImage ( ) . getJbossHome ( ) ) ) ) ; <END_BUG> fail ( "Conflicts<seq2seq4repair_space>expected" ) ; } catch ( CommandLineException e ) { final int relativeIndex = ( env . getInstalledImage ( ) . getJbossHome ( ) . getAbsolutePath ( ) . length ( ) ) + 1 ; assertConflicts ( e , conflictFile . getAbsolutePath ( ) . substring ( relativeIndex ) ) ; } finally { ctx . terminateSession ( ) ; } } protected void assertConflicts ( CommandLineException e , String ... conflicts ) { } }

Fix:
ctx . handle ( ( ( ( ( "patch<seq2seq4repair_space>rollback<seq2seq4repair_space>--patch-id=" + patchID ) + "<seq2seq4repair_space>--distribution=" ) + ( env . getInstalledImage ( ) . getJbossHome ( ) ) ) + "<seq2seq4repair_space>--reset-configuration=false" ) ) ;