public BackupOverview getBackupOverview( final JiraServiceContext jiraServiceContext, final ProjectImportOptions projectImportOptions, final TaskProgressSink taskProgressSink) { Null.not("projectImportOptions", projectImportOptions); validateJiraServiceContext(jiraServiceContext); final ErrorCollection errorCollection = jiraServiceContext.getErrorCollection(); final I18nHelper i18n = jiraServiceContext.getI18nBean(); // The user must have the system administrator permission to perform a project import if (!userHasSysAdminPermission(jiraServiceContext.getUser())) { errorCollection.addErrorMessage(getText(i18n, "admin.errors.project.import.must.be.admin")); return null; } try { final String backupPath = projectImportOptions.getPathToBackupXml(); log.info( "Project Import: Parsing the backup file '" + backupPath + "' to obtain a Backup Overview."); final BackupOverview backupOverview = projectImportManager.getBackupOverview(backupPath, taskProgressSink, i18n); log.debug("Project count for backup file = " + backupOverview.getProjects().size()); log.debug( "Entity count for backup file = " + backupOverview.getBackupSystemInformation().getEntityCount()); // Now do some further validation // BuildNumbers must be exactly the same. if (!getBuildNumber() .equalsIgnoreCase(backupOverview.getBackupSystemInformation().getBuildNumber())) { final String errorMessage = getText( i18n, "admin.errors.project.import.wrong.build.number", getBuildNumber(), backupOverview.getBackupSystemInformation().getBuildNumber()); errorCollection.addErrorMessage(errorMessage); log.error( "This data appears to be from an older version of JIRA. Please upgrade the data and try again. The current version of JIRA is at build number '" + getBuildNumber() + "', but the supplied backup file was for build number '" + backupOverview.getBackupSystemInformation().getBuildNumber() + "'."); } // Only return the backupOverview if we do not have any errors, otherwise we want to fall // through and return null if (!errorCollection.hasAnyErrors()) { log.info( "Project Import: Backup Overview was successfully extracted from '" + backupPath + "'."); return backupOverview; } } catch (final IOException e) { log.error( "There was a problem accessing the file '" + projectImportOptions.getPathToBackupXml() + "' when performing a project import.", e); errorCollection.addErrorMessage( getText( i18n, "admin.errors.project.import.problem.reading.backup", projectImportOptions.getPathToBackupXml())); } catch (final SAXException e) { log.error( "There was a problem with the SAX parsing of the file '" + projectImportOptions.getPathToBackupXml() + "' when performing a project import."); errorCollection.addErrorMessage( getText( i18n, "admin.errors.project.import.sax.problem", projectImportOptions.getPathToBackupXml(), e.getMessage())); } return null; }