From 916a4743bbaeadd42e80a03b4d64814fe6508519 Mon Sep 17 00:00:00 2001 From: wycm Date: Sun, 8 Mar 2020 16:18:22 +0800 Subject: [PATCH] Polish See gh-20419 --- .../command/init/ServiceCapabilitiesReportGenerator.java | 4 ++-- .../shell/EscapeAwareWhiteSpaceArgumentDelimiter.java | 4 ++-- .../org/springframework/boot/cli/command/shell/Shell.java | 4 ++-- .../devtools/remote/client/RemoteClientConfiguration.java | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java index 44f291f254c..002c15d127f 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/init/ServiceCapabilitiesReportGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -99,7 +99,7 @@ class ServiceCapabilitiesReportGenerator { private void reportAvailableProjectTypes(InitializrServiceMetadata metadata, StringBuilder report) { report.append("Available project types:").append(NEW_LINE); report.append("------------------------").append(NEW_LINE); - SortedSet> entries = new TreeSet<>(Comparator.comparing(Entry::getKey)); + SortedSet> entries = new TreeSet<>(Entry.comparingByKey()); entries.addAll(metadata.getProjectTypes().entrySet()); for (Entry entry : entries) { ProjectType type = entry.getValue(); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiter.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiter.java index b1363a9e2d7..0711d364ef9 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiter.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/EscapeAwareWhiteSpaceArgumentDelimiter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -95,7 +95,7 @@ class EscapeAwareWhiteSpaceArgumentDelimiter extends WhitespaceArgumentDelimiter string = string.replace("\\\\", "\\"); string = string.replace("\\t", "\t"); string = string.replace("\\\"", "\""); - string = string.replace("\\\'", "\'"); + string = string.replace("\\'", "'"); return string; } diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java index 9d91085594d..917a4fa2f8c 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/command/shell/Shell.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -221,7 +221,7 @@ public class Shell { boolean handleSigInt() { Command command = this.lastCommand; - if (command != null && command instanceof RunProcessCommand) { + if (command instanceof RunProcessCommand) { return ((RunProcessCommand) command).handleSigInt(); } return false; diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java index 4e29ea73b72..fe1d58d2339 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/RemoteClientConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ package org.springframework.boot.devtools.remote.client; import java.net.InetSocketAddress; import java.net.Proxy.Type; import java.net.URL; -import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -90,7 +90,7 @@ public class RemoteClientConfiguration implements InitializingBean { @Bean public ClientHttpRequestFactory clientHttpRequestFactory() { - List interceptors = Arrays.asList(getSecurityInterceptor()); + List interceptors = Collections.singletonList(getSecurityInterceptor()); SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); Proxy proxy = this.properties.getRemote().getProxy(); if (proxy.getHost() != null && proxy.getPort() != null) {