For example with following URL,
amazon-s3://.jgit@mybucket/foo.git
if ~/.jgit is missing, jgit command will throw a NullPointerException.
With this patch, a reasonable error message will be emitted:
fatal: Cannot read file /Users/jamesyonan/.jgit
Change-Id: I1d366f2d55e170d2972715c657c8e2d10c8d87d2
Signed-off-by: James Yonan <james@openvpn.net>
return loadPropertiesFile(propsFile);
Properties props = new Properties();
- props.setProperty("accesskey", uri.getUser()); //$NON-NLS-1$
- props.setProperty("secretkey", uri.getPass()); //$NON-NLS-1$
+ String user = uri.getUser();
+ String pass = uri.getPass();
+ if (user != null && pass != null) {
+ props.setProperty("accesskey", user); //$NON-NLS-1$
+ props.setProperty("secretkey", pass); //$NON-NLS-1$
+ } else
+ throw new NotSupportedException(MessageFormat.format(
+ JGitText.get().cannotReadFile, propsFile));
return props;
}