Skip to content

Commit 7e103ed

Browse files
committed
Formatting.
1 parent 3b569cc commit 7e103ed

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

ssh/src/main/java/ch/cyberduck/core/sftp/openssh/config/transport/OpenSshConfig.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,45 +147,35 @@ public Map<String, Host> refresh() {
147147
}
148148

149149
private Map<String, Host> parse(final InputStream in) throws IOException {
150-
final Map<String, Host> m = new LinkedHashMap<String, Host>();
150+
final Map<String, Host> m = new LinkedHashMap<>();
151151
final BufferedReader br = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
152-
final List<Host> current = new ArrayList<Host>(4);
152+
final List<Host> current = new ArrayList<>(4);
153153
String line;
154154

155155
while((line = br.readLine()) != null) {
156156
line = line.trim();
157-
if(line.length() == 0 || line.startsWith("#")) {
157+
if(line.isEmpty() || line.startsWith("#")) {
158158
continue;
159159
}
160-
161160
final String[] parts = line.split("[ \t]*[= \t]", 2);
162161
if(parts.length != 2) {
163162
continue;
164163
}
165164
final String keyword = parts[0].trim();
166165
final String argValue = parts[1].trim();
167-
168166
if("Host".equalsIgnoreCase(keyword)) {
169167
current.clear();
170168
for(final String pattern : argValue.split("[ \t]")) {
171169
final String name = dequote(pattern);
172-
Host c = m.get(name);
173-
if(c == null) {
174-
c = new Host();
175-
m.put(name, c);
176-
}
170+
Host c = m.computeIfAbsent(name, k -> new Host());
177171
current.add(c);
178172
}
179173
continue;
180174
}
181-
182175
if(current.isEmpty()) {
183-
// We received an option outside of a Host block. We
184-
// don't know who this should match against, so skip.
185-
//
176+
// We received an option outside a Host block. We don't know who this should match against, so skip.
186177
continue;
187178
}
188-
189179
if("HostName".equalsIgnoreCase(keyword)) {
190180
for(final Host c : current) {
191181
if(c.hostName == null) {
@@ -256,7 +246,6 @@ else if("BatchMode".equalsIgnoreCase(keyword)) {
256246
}
257247
}
258248
}
259-
260249
return m;
261250
}
262251

0 commit comments

Comments
 (0)