Buggy code:
@ Controller @ RequestMapping ( AnalysisPluginController . URI ) public class AnalysisPluginController extends MolgenisPluginController implements DataExplorerRegisterRefCellClickEventHandler { private static Logger logger = Logger . getLogger ( AnalysisPluginController . class ) ; public static final String ID = "analysis" ; public static final String URI = ( MolgenisPluginController . PLUGIN_URI_PREFIX ) + ( AnalysisPluginController . ID ) ; private static final String CREATE_MAPPING = "//create" ; public static final String URI_CREATE = ( AnalysisPluginController . URI ) + ( AnalysisPluginController . CREATE_MAPPING ) ; private static final String WORKFLOW_DEFAULT = "workflow.csv" ; private static final String PARAMETERS_DEFAULT = "parameters.csv" ; private static final String WORKSHEET = "worksheet.csv" ; private final DataService dataService ; @ Autowired private ClusterManager clusterManager ; private String url ; private String scheduler ; @ Autowired public AnalysisPluginController ( DataService dataService ) { } @ RequestMapping ( method = GET ) public String init ( Model model , @ RequestParam ( value = "analysis" , required = false ) String analysisId ) { } @ RequestMapping ( value = "//view//{analysisId}" , method = GET ) public String viewAnalysis ( Model model , @ PathVariable ( "analysisId" ) String analysisId ) { } @ Transactional @ RequestMapping ( value = AnalysisPluginController . CREATE_MAPPING , method = POST ) @ ResponseBody public Map < String , Object > createAnalysis ( Model model , @ Valid @ RequestBody AnalysisPluginController . CreateAnalysisRequest createAnalysisRequest ) { } @ Transactional @ RequestMapping ( value = "//clone//{analysisId}" , method = POST ) @ ResponseBody public Map < String , String > cloneAnalysis ( @ PathVariable ( "analysisId" ) String analysisId ) { final Analysis analysis = dataService . findOne ( INSTANCE . getName ( ) , analysisId , Analysis . class ) ; if ( analysis == null ) throw new UnknownEntityException ( ( ( "Unknown<seq2seq4repair_space>Analysis<seq2seq4repair_space>[" + analysisId ) + "]" ) ) ; Date clonedCreationDate = new Date ( ) ; String clonedAnalysisId = IdGenerator . generateId ( ) ; String clonedAnalysisName = generateAnalysisName ( clonedCreationDate ) ; final Analysis clonedAnalysis = new Analysis ( clonedAnalysisId , clonedAnalysisName ) ; clonedAnalysis . setBackend ( analysis . getBackend ( ) ) ; clonedAnalysis . setCreationDate ( clonedCreationDate ) ; clonedAnalysis . setDescription ( analysis . getDescription ( ) ) ; clonedAnalysis . setWorkflow ( analysis . getWorkflow ( ) ) ; dataService . add ( INSTANCE . getName ( ) , clonedAnalysis ) ; String targetEntityName = analysis . getWorkflow ( ) . getTargetType ( ) ; final String analysisAttrName = ANALYSIS_ATTRIBUTE . getName ( ) ; Iterable < Entity > targets = dataService . findAll ( targetEntityName , new QueryImpl ( ) . eq ( analysisAttrName , analysis ) ) ; dataService . update ( targetEntityName , Iterables . transform ( targets , new Function < Entity , Entity > ( ) { @ Override public Entity apply ( Entity entity ) { Iterable < Analysis > targetAnalysis = entity . getEntities ( analysisAttrName , Analysis . class ) ; <START_BUG> entity . set ( analysisAttrName , Iterables . concat ( targetAnalysis , Arrays . asList ( analysis ) ) ) ; <END_BUG> return entity ; } } ) ) ; return Collections . singletonMap ( IDENTIFIER , clonedAnalysisId ) ; } @ Transactional @ RequestMapping ( value = "//run//{analysisId}" , method = POST ) @ ResponseStatus ( HttpStatus . OK ) public void runAnalysis ( @ PathVariable ( "analysisId" ) String analysisId ) { } @ Transactional @ RequestMapping ( value = "//pause//{analysisId}" , method = POST ) @ ResponseStatus ( HttpStatus . OK ) public void pauseAnalysis ( @ PathVariable ( "analysisId" ) String analysisId ) { } @ Transactional @ RequestMapping ( value = "//continue//{analysisId}" , method = POST ) @ ResponseStatus ( HttpStatus . OK ) public void continueAnalysis ( @ PathVariable ( "analysisId" ) String analysisId ) { } @ Transactional @ RequestMapping ( value = "//stop//{analysisId}" , method = POST ) @ ResponseStatus ( HttpStatus . OK ) public void stopAnalysis ( @ PathVariable ( "analysisId" ) String analysisId ) { } @ RequestMapping ( "//{analysisId}//progress.js" ) public String getProgressScript ( @ PathVariable ( "analysisId" ) String analysisId , Model model ) { } private UIWorkflowNode findNode ( UIWorkflow uiWorkflow , String stepName ) { } private boolean isWritten ( List < String > writtenProtocols , String protocolName ) { } private void readUserProperties ( ) { } private String generateAnalysisName ( Date creationDate ) { } private static class CreateAnalysisRequest { private String workflowId ; private String targetEntityName ; private List < QueryRule > q ; public String getWorkflowId ( ) { } public String getTargetEntityName ( ) { } public List < QueryRule > getQ ( ) { } } @ Override public String getRefRedirectUrlTemplate ( ) { } }

Fix:
entity . set ( analysisAttrName , Iterables . concat ( targetAnalysis , Arrays . asList ( clonedAnalysis ) ) ) ;