private String getCredentialManagerPasswordFromFile()

in taverna-commandline-common/src/main/java/org/apache/taverna/commandline/CommandLineMasterPasswordProvider.java [154:182]


	private String getCredentialManagerPasswordFromFile() throws CommandLineMasterPasswordException {
		String password = null;
		if (commandLineOptions.hasOption(CREDENTIAL_MANAGER_DIRECTORY_OPTION)) {
			String cmDir = commandLineOptions.getCredentialManagerDir();

			File passwordFile = new File(cmDir, "password.txt");
			BufferedReader buffReader = null;
			try {
				buffReader = new BufferedReader(new FileReader(passwordFile));
				password = buffReader.readLine();
			} catch (IOException ioe) {
				// For some reason the error of the exception thrown
				// does not get printed from the Launcher so print it here as
				// well as it gives more clue as to what is going wrong.
				logger.error("There was an error reading the Credential Manager password from "
						+ passwordFile.toString() + ": " + ioe.getMessage(), ioe);
				throw new CommandLineMasterPasswordException(
						"There was an error reading the Credential Manager password from "
								+ passwordFile.toString() + ": " + ioe.getMessage(), ioe);
			} finally {
				try {
					buffReader.close();
				} catch (Exception ioe1) {
					// Ignore
				}
			}
		}
		return password;
	}