Source:
public SimpleCertificateResponseMessageType completeImportWizard(CompleteImportWizardRequestMessageType request) { String pathBackupKeystore = getPathKeystore(FOLDER_BACKUP); String pathBackupTruststore = getPathTruststore(FOLDER_BACKUP); String pathNewKeystore = getPathKeystore(FOLDER_NEW); String pathNewTruststore = getPathTruststore(FOLDER_NEW); File tempFolder = new File(getPathFolder(FOLDER_TEMP)); if (!tempFolder.exists()) { return buildSimpleResponse(false, "Temporary folder does not exist."); } try { deleteFolder(getPathFolder(FOLDER_BACKUP)); deleteFolder(getPathFolder(FOLDER_NEW)); } catch (IOException ex) { LOG.error("Error occured while cleaning up the import folders: {}, {}", FOLDER_BACKUP, FOLDER_NEW, ex); return buildSimpleResponse(false, "Error while occurred cleaning up the import folders."); } if (!copyFile(FILE_JKS_GATEWAY, pathBackupKeystore)) { return buildSimpleResponse(false, "Error occured while backup KeyStore."); } if (!copyFile(FILE_JKS_CACERTS, pathBackupTruststore)) { return buildSimpleResponse(false, "Error occured while backup TrustStore."); } if (!copyFile(getTempKeystorePath(), pathNewKeystore)) { return buildSimpleResponse(false, "Error occured while copy new KeyStore."); } File fileTemp = new File(getTempTrustorePath()); if (!fileTemp.exists()){ copyFile(FILE_JKS_CACERTS, pathNewTruststore); }else{ if(!copyFile(getTempTrustorePath(), pathNewTruststore)) { return buildSimpleResponse(false, "Error occured while copy new TrustStore."); } } try { deleteFolder(getPathFolder(FOLDER_TEMP)); } catch (IOException ex) { LOG.error("Error occured while cleaning up the temporary folder: {}", FOLDER_TEMP, ex); return buildSimpleResponse(false, "Error while occurred cleaning up the import folders."); } return buildSimpleResponse(true, MessageFormat.format( "Please go to the server {0}. Go to importWizard/new, copy and replace the KeyStore and TrustStore (server restart required).", DIR_NHINC_PROPERTIES)); }

Target:
public SimpleCertificateResponseMessageType completeImportWizard(CompleteImportWizardRequestMessageType request) { String pathBackupKeystore = getPathKeystore(FOLDER_BACKUP); String pathBackupTruststore = getPathTruststore(FOLDER_BACKUP); String pathNewKeystore = getPathKeystore(FOLDER_NEW); String pathNewTruststore = getPathTruststore(FOLDER_NEW); File tempFolder = new File(getPathFolder(FOLDER_TEMP)); if (!tempFolder.exists()) { return buildSimpleResponse(false, "The import process has not been started yet."); } try { deleteFolder(getPathFolder(FOLDER_BACKUP)); deleteFolder(getPathFolder(FOLDER_NEW)); } catch (IOException ex) { LOG.error("Error occured while cleaning up the import folders: {}, {}", FOLDER_BACKUP, FOLDER_NEW, ex); return buildSimpleResponse(false, "Error while occurred cleaning up the import folders."); } if (!copyFile(FILE_JKS_GATEWAY, pathBackupKeystore)) { return buildSimpleResponse(false, "Error occured while backup KeyStore."); } if (!copyFile(FILE_JKS_CACERTS, pathBackupTruststore)) { return buildSimpleResponse(false, "Error occured while backup TrustStore."); } if (!copyFile(getTempKeystorePath(), pathNewKeystore)) { return buildSimpleResponse(false, "Error occured while copy new KeyStore."); } File fileTemp = new File(getTempTrustorePath()); if (!fileTemp.exists()){ copyFile(FILE_JKS_CACERTS, pathNewTruststore); }else{ if(!copyFile(getTempTrustorePath(), pathNewTruststore)) { return buildSimpleResponse(false, "Error occured while copy new TrustStore."); } } try { deleteFolder(getPathFolder(FOLDER_TEMP)); } catch (IOException ex) { LOG.error("Error occured while cleaning up the temporary folder: {}", FOLDER_TEMP, ex); return buildSimpleResponse(false, "Error while occurred cleaning up the import folders."); } return buildSimpleResponse(true, MessageFormat.format( "Please replace your existing KeyStore and TrustStore with the ones provided at {0}/importWizard/new. Note: A server restart may be required", DIR_NHINC_PROPERTIES)); }