Upgrade to spring-javaformat 0.0.6

This commit is contained in:
Phillip Webb
2018-08-28 15:22:36 -07:00
parent 17de1571f5
commit 9543fcf44d
290 changed files with 1021 additions and 1014 deletions

View File

@@ -95,9 +95,10 @@ public class RemoteDevToolsAutoConfiguration {
@Bean
public HandlerMapper remoteDevToolsHealthCheckHandlerMapper() {
Handler handler = new HttpStatusHandler();
return new UrlHandlerMapper((this.serverProperties.getContextPath() != null
? this.serverProperties.getContextPath() : "")
+ this.properties.getRemote().getContextPath(), handler);
String serverContextPath = (this.serverProperties.getContextPath() != null)
? this.serverProperties.getContextPath() : "";
String remoteContextPath = this.properties.getRemote().getContextPath();
return new UrlHandlerMapper(serverContextPath + remoteContextPath, handler);
}
@Bean
@@ -136,9 +137,10 @@ public class RemoteDevToolsAutoConfiguration {
@Bean
@ConditionalOnMissingBean(name = "remoteRestartHandlerMapper")
public UrlHandlerMapper remoteRestartHandlerMapper(HttpRestartServer server) {
String url = (this.serverProperties.getContextPath() != null
? this.serverProperties.getContextPath() : "")
+ this.properties.getRemote().getContextPath() + "/restart";
String serverContextPath = (this.serverProperties.getContextPath() != null)
? this.serverProperties.getContextPath() : "";
String remoteContextPath = this.properties.getRemote().getContextPath();
String url = serverContextPath + remoteContextPath + "/restart";
logger.warn("Listening for remote restart updates on " + url);
Handler handler = new HttpRestartServerHandler(server);
return new UrlHandlerMapper(url, handler);
@@ -162,9 +164,10 @@ public class RemoteDevToolsAutoConfiguration {
@ConditionalOnMissingBean(name = "remoteDebugHandlerMapper")
public UrlHandlerMapper remoteDebugHandlerMapper(
@Qualifier("remoteDebugHttpTunnelServer") HttpTunnelServer server) {
String url = (this.serverProperties.getContextPath() != null
? this.serverProperties.getContextPath() : "")
+ this.properties.getRemote().getContextPath() + "/debug";
String serverContextPath = (this.serverProperties.getContextPath() != null)
? this.serverProperties.getContextPath() : "";
String remoteContextPath = this.properties.getRemote().getContextPath();
String url = serverContextPath + remoteContextPath + "/debug";
logger.warn("Listening for remote debug traffic on " + url);
Handler handler = new HttpTunnelServerHandler(server);
return new UrlHandlerMapper(url, handler);

View File

@@ -44,7 +44,7 @@ public class DevToolsHomePropertiesPostProcessor implements EnvironmentPostProce
public void postProcessEnvironment(ConfigurableEnvironment environment,
SpringApplication application) {
File home = getHomeFolder();
File propertyFile = (home != null ? new File(home, FILE_NAME) : null);
File propertyFile = (home != null) ? new File(home, FILE_NAME) : null;
if (propertyFile != null && propertyFile.exists() && propertyFile.isFile()) {
FileSystemResource resource = new FileSystemResource(propertyFile);
Properties properties;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 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.
@@ -81,11 +81,6 @@ public final class ChangedFile {
return fileName.substring(folderName.length() + 1);
}
@Override
public int hashCode() {
return this.file.hashCode() * 31 + this.type.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
@@ -101,6 +96,11 @@ public final class ChangedFile {
return super.equals(obj);
}
@Override
public int hashCode() {
return this.file.hashCode() * 31 + this.type.hashCode();
}
@Override
public String toString() {
return this.file + " (" + this.type + ")";

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2018 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.
@@ -61,11 +61,6 @@ public final class ChangedFiles implements Iterable<ChangedFile> {
return this.files;
}
@Override
public int hashCode() {
return this.files.hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
@@ -82,6 +77,11 @@ public final class ChangedFiles implements Iterable<ChangedFile> {
return super.equals(obj);
}
@Override
public int hashCode() {
return this.files.hashCode();
}
@Override
public String toString() {
return this.sourceFolder + " " + this.files;

View File

@@ -134,8 +134,8 @@ public class ClassPathChangeUploader
private void logUpload(ClassLoaderFiles classLoaderFiles) {
int size = classLoaderFiles.size();
logger.info(
"Uploaded " + size + " class " + (size != 1 ? "resources" : "resource"));
logger.info("Uploaded " + size + " class "
+ ((size != 1) ? "resources" : "resource"));
}
private byte[] serialize(ClassLoaderFiles classLoaderFiles) throws IOException {
@@ -162,10 +162,10 @@ public class ClassPathChangeUploader
private ClassLoaderFile asClassLoaderFile(ChangedFile changedFile)
throws IOException {
ClassLoaderFile.Kind kind = TYPE_MAPPINGS.get(changedFile.getType());
byte[] bytes = (kind != Kind.DELETED
? FileCopyUtils.copyToByteArray(changedFile.getFile()) : null);
long lastModified = (kind != Kind.DELETED ? changedFile.getFile().lastModified()
: System.currentTimeMillis());
byte[] bytes = (kind != Kind.DELETED)
? FileCopyUtils.copyToByteArray(changedFile.getFile()) : null;
long lastModified = (kind != Kind.DELETED) ? changedFile.getFile().lastModified()
: System.currentTimeMillis();
return new ClassLoaderFile(kind, lastModified, bytes);
}

View File

@@ -55,8 +55,8 @@ public class ClassLoaderFile implements Serializable {
*/
public ClassLoaderFile(Kind kind, long lastModified, byte[] contents) {
Assert.notNull(kind, "Kind must not be null");
Assert.isTrue(kind != Kind.DELETED ? contents != null : contents == null,
"Contents must " + (kind != Kind.DELETED ? "not " : "") + "be null");
Assert.isTrue((kind != Kind.DELETED) ? contents != null : contents == null,
"Contents must " + ((kind != Kind.DELETED) ? "not " : "") + "be null");
this.kind = kind;
this.lastModified = lastModified;
this.contents = contents;

View File

@@ -91,9 +91,9 @@ public class RestartClassLoader extends URLClassLoader implements SmartClassLoad
}
Method classLoadingLockMethod = ReflectionUtils.findMethod(ClassLoader.class,
"getClassLoadingLock", String.class);
this.classLoadingLockSupplier = (classLoadingLockMethod != null
this.classLoadingLockSupplier = (classLoadingLockMethod != null)
? new StandardClassLoadingLockSupplier()
: new Java6ClassLoadingLockSupplier());
: new Java6ClassLoadingLockSupplier();
}
@Override

View File

@@ -91,8 +91,8 @@ public class HttpTunnelConnection implements TunnelConnection {
throw new IllegalArgumentException("Malformed URL '" + url + "'");
}
this.requestFactory = requestFactory;
this.executor = (executor != null ? executor
: Executors.newCachedThreadPool(new TunnelThreadFactory()));
this.executor = (executor != null) ? executor
: Executors.newCachedThreadPool(new TunnelThreadFactory());
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2018 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.
@@ -29,10 +29,10 @@ public interface TunnelConnection {
/**
* Open the tunnel connection.
* @param incomingChannel A {@link WritableByteChannel} that should be used to write
* @param incomingChannel a {@link WritableByteChannel} that should be used to write
* any incoming data received from the remote server.
* @param closeable a closeable to call when the channel is closed
* @return A {@link WritableByteChannel} that should be used to send any outgoing data
* @return a {@link WritableByteChannel} that should be used to send any outgoing data
* destined for the remote server
* @throws Exception in case of errors
*/

View File

@@ -139,7 +139,7 @@ public class ClassPathChangeUploaderTests {
private void assertClassFile(ClassLoaderFile file, String content, Kind kind) {
assertThat(file.getContents())
.isEqualTo(content != null ? content.getBytes() : null);
.isEqualTo((content != null) ? content.getBytes() : null);
assertThat(file.getKind()).isEqualTo(kind);
}