diff options
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java index a97c09bfe9..01716da70a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java @@ -91,9 +91,9 @@ public class OpenSshConfig { public static OpenSshConfig get(FS fs) { File home = fs.userHome(); if (home == null) - home = new File(".").getAbsoluteFile(); + home = new File(".").getAbsoluteFile(); //$NON-NLS-1$ - final File config = new File(new File(home, ".ssh"), Constants.CONFIG); + final File config = new File(new File(home, ".ssh"), Constants.CONFIG); //$NON-NLS-1$ final OpenSshConfig osc = new OpenSshConfig(home, config); osc.refresh(); return osc; @@ -180,16 +180,16 @@ public class OpenSshConfig { while ((line = br.readLine()) != null) { line = line.trim(); - if (line.length() == 0 || line.startsWith("#")) + if (line.length() == 0 || line.startsWith("#")) //$NON-NLS-1$ continue; - final String[] parts = line.split("[ \t]*[= \t]", 2); + final String[] parts = line.split("[ \t]*[= \t]", 2); //$NON-NLS-1$ final String keyword = parts[0].trim(); final String argValue = parts[1].trim(); - if (StringUtils.equalsIgnoreCase("Host", keyword)) { + if (StringUtils.equalsIgnoreCase("Host", keyword)) { //$NON-NLS-1$ current.clear(); - for (final String pattern : argValue.split("[ \t]")) { + for (final String pattern : argValue.split("[ \t]")) { //$NON-NLS-1$ final String name = dequote(pattern); Host c = m.get(name); if (c == null) { @@ -208,15 +208,15 @@ public class OpenSshConfig { continue; } - if (StringUtils.equalsIgnoreCase("HostName", keyword)) { + if (StringUtils.equalsIgnoreCase("HostName", keyword)) { //$NON-NLS-1$ for (final Host c : current) if (c.hostName == null) c.hostName = dequote(argValue); - } else if (StringUtils.equalsIgnoreCase("User", keyword)) { + } else if (StringUtils.equalsIgnoreCase("User", keyword)) { //$NON-NLS-1$ for (final Host c : current) if (c.user == null) c.user = dequote(argValue); - } else if (StringUtils.equalsIgnoreCase("Port", keyword)) { + } else if (StringUtils.equalsIgnoreCase("Port", keyword)) { //$NON-NLS-1$ try { final int port = Integer.parseInt(dequote(argValue)); for (final Host c : current) @@ -225,19 +225,21 @@ public class OpenSshConfig { } catch (NumberFormatException nfe) { // Bad port number. Don't set it. } - } else if (StringUtils.equalsIgnoreCase("IdentityFile", keyword)) { + } else if (StringUtils.equalsIgnoreCase("IdentityFile", keyword)) { //$NON-NLS-1$ for (final Host c : current) if (c.identityFile == null) c.identityFile = toFile(dequote(argValue)); - } else if (StringUtils.equalsIgnoreCase("PreferredAuthentications", keyword)) { + } else if (StringUtils.equalsIgnoreCase( + "PreferredAuthentications", keyword)) { //$NON-NLS-1$ for (final Host c : current) if (c.preferredAuthentications == null) c.preferredAuthentications = nows(dequote(argValue)); - } else if (StringUtils.equalsIgnoreCase("BatchMode", keyword)) { + } else if (StringUtils.equalsIgnoreCase("BatchMode", keyword)) { //$NON-NLS-1$ for (final Host c : current) if (c.batchMode == null) c.batchMode = yesno(dequote(argValue)); - } else if (StringUtils.equalsIgnoreCase("StrictHostKeyChecking", keyword)) { + } else if (StringUtils.equalsIgnoreCase( + "StrictHostKeyChecking", keyword)) { //$NON-NLS-1$ String value = dequote(argValue); for (final Host c : current) if (c.strictHostKeyChecking == null) @@ -264,7 +266,7 @@ public class OpenSshConfig { } private static String dequote(final String value) { - if (value.startsWith("\"") && value.endsWith("\"")) + if (value.startsWith("\"") && value.endsWith("\"")) //$NON-NLS-1$ //$NON-NLS-2$ return value.substring(1, value.length() - 1); return value; } @@ -279,13 +281,13 @@ public class OpenSshConfig { } private static Boolean yesno(final String value) { - if (StringUtils.equalsIgnoreCase("yes", value)) + if (StringUtils.equalsIgnoreCase("yes", value)) //$NON-NLS-1$ return Boolean.TRUE; return Boolean.FALSE; } private File toFile(final String path) { - if (path.startsWith("~/")) + if (path.startsWith("~/")) //$NON-NLS-1$ return new File(home, path.substring(2)); File ret = new File(path); if (ret.isAbsolute()) @@ -296,7 +298,7 @@ public class OpenSshConfig { static String userName() { return AccessController.doPrivileged(new PrivilegedAction<String>() { public String run() { - return System.getProperty("user.name"); + return System.getProperty("user.name"); //$NON-NLS-1$ } }); } |