Source:
<code>private void assureSuperUserPasswordIsSet(final Properties properties) { final boolean unhashedPasswordWasPresent = properties.containsKey(ServerConfiguration.SUPER_USER_PASSWORD); String password = null; if (!unhashedPasswordWasPresent) { if (properties.containsKey(ServerConfiguration.SUPER_USER_PASSWORD_HASH) && properties.containsKey(ServerConfiguration.SUPER_USER_PASSWORD_SALT)) { return; } final Scanner scanner = new Scanner(System.in); boolean passwordDidNotMatch = true; while (passwordDidNotMatch) { System.out.println(Messages.EMFStoreController_NoSuperUserPasswordPrompt); final String pw1 = scanner.nextLine(); System.out.println(Messages.EMFStoreController_EnterSuperUserPasswordAgain); final String pw2 = scanner.nextLine(); if (pw1 != null && pw1.equals(pw2)) { password = pw1; passwordDidNotMatch = false; } else { System.out.println(Messages.EMFStoreController_PasswordDidNotMatch); } } <START> scanner.close(); <END> } else { password = properties.getProperty(ServerConfiguration.SUPER_USER_PASSWORD); } final ESPasswordHashGenerator passwordHashGenerator = AccessControl.getESPasswordHashGenerator(); try { final ESHashAndSalt hashAndSalt = passwordHashGenerator.hashPassword(password); properties.setProperty(ServerConfiguration.SUPER_USER_PASSWORD_SALT, hashAndSalt.getSalt()); properties.setProperty(ServerConfiguration.SUPER_USER_PASSWORD_HASH, hashAndSalt.getHash()); properties.remove(ServerConfiguration.SUPER_USER_PASSWORD); final File propertyFile = new File(ServerConfiguration.getConfFile()); properties.store(new FileOutputStream(propertyFile), ""); } catch (final FileNotFoundException ex) { ModelUtil.logWarning(Messages.EMFStoreController_PasswordHashFailFileNotFound, ex); } catch (final IOException ex) { ModelUtil.logWarning(Messages.EMFStoreController_PasswordHashFailIOException, ex); } if (unhashedPasswordWasPresent) { ServerConfiguration.initUserVerifierMigration(); } }</code><technical_language>Close in finally Block</technical_language>

Target:
private void assureSuperUserPasswordIsSet(final Properties properties) { final boolean unhashedPasswordWasPresent = properties.containsKey(ServerConfiguration.SUPER_USER_PASSWORD); String password = null; if (!unhashedPasswordWasPresent) { if (properties.containsKey(ServerConfiguration.SUPER_USER_PASSWORD_HASH) && properties.containsKey(ServerConfiguration.SUPER_USER_PASSWORD_SALT)) { return; } final Scanner scanner = new Scanner(System.in); try { boolean passwordDidNotMatch = true; while (passwordDidNotMatch) { System.out.println(Messages.EMFStoreController_NoSuperUserPasswordPrompt); final String pw1 = scanner.nextLine(); System.out.println(Messages.EMFStoreController_EnterSuperUserPasswordAgain); final String pw2 = scanner.nextLine(); if (pw1 != null && pw1.equals(pw2)) { password = pw1; passwordDidNotMatch = false; } else { System.out.println(Messages.EMFStoreController_PasswordDidNotMatch); } } } finally { scanner.close(); } } else { password = properties.getProperty(ServerConfiguration.SUPER_USER_PASSWORD); } final ESPasswordHashGenerator passwordHashGenerator = AccessControl.getESPasswordHashGenerator(); final File propertyFile = new File(ServerConfiguration.getConfFile()); FileOutputStream propertyFileOutputStream = null; try { propertyFileOutputStream = new FileOutputStream(propertyFile); final ESHashAndSalt hashAndSalt = passwordHashGenerator.hashPassword(password); properties.setProperty(ServerConfiguration.SUPER_USER_PASSWORD_SALT, hashAndSalt.getSalt()); properties.setProperty(ServerConfiguration.SUPER_USER_PASSWORD_HASH, hashAndSalt.getHash()); properties.remove(ServerConfiguration.SUPER_USER_PASSWORD); properties.store(propertyFileOutputStream, ""); } catch (final FileNotFoundException ex) { ModelUtil.logWarning(Messages.EMFStoreController_PasswordHashFailFileNotFound, ex); } catch (final IOException ex) { ModelUtil.logWarning(Messages.EMFStoreController_PasswordHashFailIOException, ex); } finally { if (propertyFileOutputStream != null) { try { propertyFileOutputStream.close(); } catch (final IOException ex) { ModelUtil.logException(ex); } } } if (unhashedPasswordWasPresent) { ServerConfiguration.initUserVerifierMigration(); } }