Source:
public String handleRequest(HttpServletRequest request, BindingResult result, Wizard wizard) { ImportWizardUtil.validateImportWizard(wizard); ImportWizard importWizard = (ImportWizard) wizard; String dataImportOption = request.getParameter("data_option"); importWizard.setDataImportOption(dataImportOption); String metadataImportOption = request.getParameter("metadata-option"); importWizard.setMetadataImportOption(metadataImportOption); if (importWizard.getMustChangeEntityName()) { String userGivenName = request.getParameter("name"); if (StringUtils.isEmpty(userGivenName)) { result.addError(new ObjectError("wizard", "Please enter an entity name")); return null; } try { NameValidator.validateEntityName(userGivenName); if (dataService.hasRepository(userGivenName)) { result.addError(new ObjectError("wizard", "An entity with this name already exists.")); return null; } } catch (MolgenisDataException e) { ImportWizardUtil.handleException(e, importWizard, result, LOG, dataImportOption); return null; } File tmpFile = importWizard.getFile(); String fileName = tmpFile.getName(); String extension = FileExtensionUtils.findExtensionFromPossibilities(fileName, fileRepositoryCollectionFactory.createFileRepositoryCollection(tmpFile).getFileNameExtensions()); File file = new File(tmpFile.getParent(), userGivenName + "." + extension); if (!tmpFile.renameTo(file)) { LOG.error("Failed to rename '{}' to '{}'", tmpFile.getName(), file.getName()); } importWizard.setFile(file); } try { return validateInput(importWizard.getFile(), importWizard, result); } catch (Exception e) { ImportWizardUtil.handleException(e, importWizard, result, LOG, dataImportOption); } return null; }

Target:
public String handleRequest(HttpServletRequest request, BindingResult result, Wizard wizard) { ImportWizardUtil.validateImportWizard(wizard); ImportWizard importWizard = (ImportWizard) wizard; String dataImportOption = request.getParameter("data-option"); importWizard.setDataImportOption(dataImportOption); String metadataImportOption = request.getParameter("metadata-option"); importWizard.setMetadataImportOption(metadataImportOption); if (importWizard.getMustChangeEntityName()) { String userGivenName = request.getParameter("name"); if (StringUtils.isEmpty(userGivenName)) { result.addError(new ObjectError("wizard", "Please enter an entity name")); return null; } try { NameValidator.validateEntityName(userGivenName); if (dataService.hasRepository(userGivenName)) { result.addError(new ObjectError("wizard", "An entity with this name already exists.")); return null; } } catch (MolgenisDataException e) { ImportWizardUtil.handleException(e, importWizard, result, LOG, dataImportOption); return null; } File tmpFile = importWizard.getFile(); String fileName = tmpFile.getName(); String extension = FileExtensionUtils.findExtensionFromPossibilities(fileName, fileRepositoryCollectionFactory.createFileRepositoryCollection(tmpFile).getFileNameExtensions()); File file = new File(tmpFile.getParent(), userGivenName + "." + extension); if (!tmpFile.renameTo(file)) { LOG.error("Failed to rename '{}' to '{}'", tmpFile.getName(), file.getName()); } importWizard.setFile(file); } try { return validateInput(importWizard.getFile(), importWizard, result); } catch (Exception e) { ImportWizardUtil.handleException(e, importWizard, result, LOG, dataImportOption); } return null; }