Fix checkstyle ternary issues

Fix checkstyle issues with ternary expressions following the
spring-javaformat upgrade.

See gh-13932
This commit is contained in:
Phillip Webb
2018-07-27 22:54:20 +01:00
parent ec1100a896
commit 7fc455654a
293 changed files with 714 additions and 685 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 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.
@@ -109,8 +109,8 @@ public class DefaultLaunchScript implements LaunchScript {
}
}
else {
value = (defaultValue != null ? defaultValue.substring(1)
: matcher.group(0));
value = (defaultValue != null) ? defaultValue.substring(1)
: matcher.group(0);
}
matcher.appendReplacement(expanded, value.replace("$", "\\$"));
}

View File

@@ -363,7 +363,7 @@ public class JarWriter implements LoaderClassesWriter, AutoCloseable {
@Override
public int read() throws IOException {
int read = (this.headerStream != null ? this.headerStream.read() : -1);
int read = (this.headerStream != null) ? this.headerStream.read() : -1;
if (read != -1) {
this.position++;
if (this.position >= this.headerLength) {
@@ -381,8 +381,8 @@ public class JarWriter implements LoaderClassesWriter, AutoCloseable {
@Override
public int read(byte[] b, int off, int len) throws IOException {
int read = (this.headerStream != null ? this.headerStream.read(b, off, len)
: -1);
int read = (this.headerStream != null) ? this.headerStream.read(b, off, len)
: -1;
if (read <= 0) {
return readRemainder(b, off, len);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 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.
@@ -63,7 +63,7 @@ public class Library {
* @param unpackRequired if the library needs to be unpacked before it can be used
*/
public Library(String name, File file, LibraryScope scope, boolean unpackRequired) {
this.name = (name != null ? name : file.getName());
this.name = (name != null) ? name : file.getName();
this.file = file;
this.scope = scope;
this.unpackRequired = unpackRequired;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2017 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.
@@ -248,7 +248,7 @@ public abstract class MainClassFinder {
private static List<JarEntry> getClassEntries(JarFile source,
String classesLocation) {
classesLocation = (classesLocation != null ? classesLocation : "");
classesLocation = (classesLocation != null) ? classesLocation : "";
Enumeration<JarEntry> sourceEntries = source.entries();
List<JarEntry> classEntries = new ArrayList<>();
while (sourceEntries.hasMoreElements()) {