@Override public void remove() throws LifecycleException { // We use the managed file so that if the UoW gets discarded the file will be restored File file = hasUoWFile.managedFile(); if ( file.exists() && !file.delete() ) { throw new LifecycleException( "Unable to delete existing file: " + file ); } }
@Override public void remove() throws LifecycleException { // We use the managed files so that if the UoW gets discarded the files will be restored List<File> errors = new ArrayList<File>(); for ( File eachFile : hasUoWFiles.managedFiles() ) { if ( eachFile.exists() ) { if ( !eachFile.delete() ) { errors.add( eachFile ); } } } if ( !errors.isEmpty() ) { throw new LifecycleException( "Unable to delete existing files: " + errors ); } }