Fix checkstyle violations

This commit is contained in:
Phillip Webb 2018-05-31 16:10:09 -07:00
parent 45688ffcd2
commit 91a2db4176
26 changed files with 125 additions and 123 deletions

View File

@ -172,7 +172,8 @@ public class CommandLineHelpGenerator {
.collect(Collectors.toList())) {
String[] data = new String[3];
data[0] = dep.getId();
data[1] = dep.getDescription() != null ? dep.getDescription() : dep.getName();
data[1] = (dep.getDescription() != null ? dep.getDescription()
: dep.getName());
data[2] = dep.getVersionRequirement();
dependencyTable[i++] = data;
}
@ -194,8 +195,8 @@ public class CommandLineHelpGenerator {
.collect(Collectors.toList())) {
String[] data = new String[typeTable[0].length];
data[0] = (type.isDefault() ? type.getId() + " *" : type.getId());
data[1] = type.getDescription() != null ? type.getDescription()
: type.getName();
data[1] = (type.getDescription() != null ? type.getDescription()
: type.getName());
if (addTags) {
data[2] = buildTagRepresentation(type);
}

View File

@ -217,8 +217,8 @@ public class ProjectGenerator {
try {
rootDir = File.createTempFile("tmp", "", getTemporaryDirectory());
}
catch (IOException e) {
throw new IllegalStateException("Cannot create temp dir", e);
catch (IOException ex) {
throw new IllegalStateException("Cannot create temp dir", ex);
}
addTempFile(rootDir.getName(), rootDir);
rootDir.delete();
@ -615,8 +615,8 @@ public class ProjectGenerator {
}
private void writeGradleWrapper(File dir, Version bootVersion) {
String gradlePrefix = isGradle4Available(bootVersion) ? "gradle4"
: isGradle3Available(bootVersion) ? "gradle3" : "gradle";
String gradlePrefix = (isGradle4Available(bootVersion) ? "gradle4"
: (isGradle3Available(bootVersion) ? "gradle3" : "gradle"));
writeTextResource(dir, "gradlew.bat", gradlePrefix + "/gradlew.bat");
writeTextResource(dir, "gradlew", gradlePrefix + "/gradlew");
@ -682,8 +682,8 @@ public class ProjectGenerator {
try (OutputStream stream = new FileOutputStream(target)) {
StreamUtils.copy(body, Charset.forName("UTF-8"), stream);
}
catch (Exception e) {
throw new IllegalStateException("Cannot write file " + target, e);
catch (Exception ex) {
throw new IllegalStateException("Cannot write file " + target, ex);
}
}
@ -691,8 +691,8 @@ public class ProjectGenerator {
try (OutputStream stream = new FileOutputStream(target)) {
StreamUtils.copy(body, stream);
}
catch (Exception e) {
throw new IllegalStateException("Cannot write file " + target, e);
catch (Exception ex) {
throw new IllegalStateException("Cannot write file " + target, ex);
}
}
@ -757,8 +757,8 @@ public class ProjectGenerator {
}
private String generateImport(String type, String language) {
String end = ("groovy".equals(language) || "kotlin".equals(language)) ? ""
: ";";
String end = (("groovy".equals(language) || "kotlin".equals(language)) ? ""
: ";");
return "import " + type + end;
}

View File

@ -134,9 +134,9 @@ public class ProjectRequest extends BasicProjectRequest {
* @param metadata the initializr metadata
*/
public void resolve(InitializrMetadata metadata) {
List<String> depIds = !getStyle().isEmpty() ? getStyle() : getDependencies();
String actualBootVersion = getBootVersion() != null ? getBootVersion()
: metadata.getBootVersions().getDefault().getId();
List<String> depIds = (!getStyle().isEmpty() ? getStyle() : getDependencies());
String actualBootVersion = (getBootVersion() != null ? getBootVersion()
: metadata.getBootVersions().getDefault().getId());
Version requestedVersion = Version.parse(actualBootVersion);
this.resolvedDependencies = depIds.stream().map((it) -> {
Dependency dependency = metadata.getDependencies().get(it);

View File

@ -149,8 +149,8 @@ public class Dependency extends MetadataElement implements Describable {
}
public void setVersionRange(String versionRange) {
this.versionRange = StringUtils.hasText(versionRange) ? versionRange.trim()
: null;
this.versionRange = (StringUtils.hasText(versionRange) ? versionRange.trim()
: null);
}
/**
@ -170,8 +170,8 @@ public class Dependency extends MetadataElement implements Describable {
*/
public Dependency asSpringBootStarter(String name) {
this.groupId = "org.springframework.boot";
this.artifactId = StringUtils.hasText(name) ? "spring-boot-starter-" + name
: "spring-boot-starter";
this.artifactId = (StringUtils.hasText(name) ? "spring-boot-starter-" + name
: "spring-boot-starter");
if (StringUtils.hasText(name)) {
setId(name);
}
@ -247,12 +247,12 @@ public class Dependency extends MetadataElement implements Describable {
for (Mapping mapping : this.mappings) {
if (mapping.range.match(bootVersion)) {
Dependency dependency = new Dependency(this);
dependency.groupId = mapping.groupId != null ? mapping.groupId
: this.groupId;
dependency.artifactId = mapping.artifactId != null ? mapping.artifactId
: this.artifactId;
dependency.version = mapping.version != null ? mapping.version
: this.version;
dependency.groupId = (mapping.groupId != null ? mapping.groupId
: this.groupId);
dependency.artifactId = (mapping.artifactId != null ? mapping.artifactId
: this.artifactId);
dependency.version = (mapping.version != null ? mapping.version
: this.version);
dependency.versionRequirement = mapping.range.toString();
dependency.mappings = null;
return dependency;

View File

@ -240,8 +240,8 @@ public class InitializrConfiguration {
new Repository("Spring Milestones",
new URL("https://repo.spring.io/milestone"), false));
}
catch (MalformedURLException e) {
throw new IllegalStateException("Cannot parse URL", e);
catch (MalformedURLException ex) {
throw new IllegalStateException("Cannot parse URL", ex);
}
}
@ -517,9 +517,9 @@ public class InitializrConfiguration {
* @return the parent POM
*/
public ParentPom resolveParentPom(String bootVersion) {
return StringUtils.hasText(this.parent.groupId) ? this.parent
return (StringUtils.hasText(this.parent.groupId) ? this.parent
: new ParentPom("org.springframework.boot",
"spring-boot-starter-parent", bootVersion);
"spring-boot-starter-parent", bootVersion));
}
/**

View File

@ -274,7 +274,7 @@ public class InitializrMetadata {
private static String defaultId(
Defaultable<? extends DefaultMetadataElement> element) {
DefaultMetadataElement defaultValue = element.getDefault();
return defaultValue != null ? defaultValue.getId() : null;
return (defaultValue != null ? defaultValue.getId() : null);
}
private static class ArtifactIdCapability extends TextCapability {
@ -289,7 +289,7 @@ public class InitializrMetadata {
@Override
public String getContent() {
String value = super.getContent();
return value == null ? this.nameCapability.getContent() : value;
return (value != null ? value : this.nameCapability.getContent());
}
}

View File

@ -98,8 +98,8 @@ public final class InitializrMetadataBuilder {
* @return a new {@link InitializrMetadata} instance
*/
public InitializrMetadata build() {
InitializrConfiguration config = this.configuration != null ? this.configuration
: new InitializrConfiguration();
InitializrConfiguration config = (this.configuration != null ? this.configuration
: new InitializrConfiguration());
InitializrMetadata metadata = createInstance(config);
for (InitializrMetadataCustomizer customizer : this.customizers) {
customizer.customize(metadata);
@ -210,8 +210,8 @@ public final class InitializrMetadataBuilder {
InitializrMetadata.class);
metadata.merge(anotherMetadata);
}
catch (Exception e) {
throw new IllegalStateException("Cannot merge", e);
catch (Exception ex) {
throw new IllegalStateException("Cannot merge", ex);
}
}

View File

@ -158,8 +158,8 @@ public class Link {
try {
return new URI(result.get());
}
catch (URISyntaxException e) {
throw new IllegalStateException("Invalid URL", e);
catch (URISyntaxException ex) {
throw new IllegalStateException("Invalid URL", ex);
}
}

View File

@ -46,7 +46,7 @@ public class MetadataElement {
}
public String getName() {
return this.name != null ? this.name : this.id;
return (this.name != null ? this.name : this.id);
}
public String getId() {

View File

@ -69,9 +69,9 @@ public class TemplateRenderer {
Template template = getTemplate(name);
return template.execute(model);
}
catch (Exception e) {
log.error("Cannot render: " + name, e);
throw new IllegalStateException("Cannot render template", e);
catch (Exception ex) {
log.error("Cannot render: " + name, ex);
throw new IllegalStateException("Cannot render template", ex);
}
}
@ -88,8 +88,8 @@ public class TemplateRenderer {
template = this.mustache.loader.getTemplate(name);
return this.mustache.compile(template);
}
catch (Exception e) {
throw new IllegalStateException("Cannot load template " + name, e);
catch (Exception ex) {
throw new IllegalStateException("Cannot load template " + name, ex);
}
}

View File

@ -114,7 +114,7 @@ public final class Version implements Serializable, Comparable<Version> {
try {
return parse(text);
}
catch (InvalidVersionException e) {
catch (InvalidVersionException ex) {
return null;
}
}
@ -140,8 +140,8 @@ public final class Version implements Serializable, Comparable<Version> {
}
private static int safeCompare(Integer first, Integer second) {
Integer firstIndex = first != null ? first : 0;
Integer secondIndex = second != null ? second : 0;
Integer firstIndex = (first != null ? first : 0);
Integer secondIndex = (second != null ? second : 0);
return firstIndex.compareTo(secondIndex);
}
@ -296,16 +296,17 @@ public final class Version implements Serializable, Comparable<Version> {
@Override
public int compare(Qualifier o1, Qualifier o2) {
Qualifier first = o1 != null ? o1 : new Qualifier(RELEASE);
Qualifier second = o2 != null ? o2 : new Qualifier(RELEASE);
Qualifier first = (o1 != null ? o1 : new Qualifier(RELEASE));
Qualifier second = (o2 != null ? o2 : new Qualifier(RELEASE));
int qualifier = compareQualifier(first, second);
return qualifier != 0 ? qualifier : compareQualifierVersion(first, second);
return (qualifier != 0 ? qualifier : compareQualifierVersion(first, second));
}
private static int compareQualifierVersion(Qualifier first, Qualifier second) {
Integer firstVersion = first.getVersion() != null ? first.getVersion() : 0;
Integer secondVersion = second.getVersion() != null ? second.getVersion() : 0;
Integer firstVersion = (first.getVersion() != null ? first.getVersion() : 0);
Integer secondVersion = (second.getVersion() != null ? second.getVersion()
: 0);
return firstVersion.compareTo(secondVersion);
}
@ -323,8 +324,8 @@ public final class Version implements Serializable, Comparable<Version> {
}
private static int getQualifierIndex(String qualifier) {
return StringUtils.hasText(qualifier) ? KNOWN_QUALIFIERS.indexOf(qualifier)
: 0;
return (StringUtils.hasText(qualifier) ? KNOWN_QUALIFIERS.indexOf(qualifier)
: 0);
}
}

View File

@ -89,7 +89,7 @@ public class VersionParser {
}
}
if ("x".equals(minor) || "x".equals(patch)) {
Integer minorInt = "x".equals(minor) ? null : Integer.parseInt(minor);
Integer minorInt = ("x".equals(minor) ? null : Integer.parseInt(minor));
Version latest = findLatestVersion(major, minorInt, qualifier);
if (latest == null) {
return new Version(major,
@ -159,7 +159,7 @@ public class VersionParser {
}
return true;
}).collect(Collectors.toList());
return (matches.size() == 1 ? matches.get(0) : null);
return (matches.size() != 1 ? null : matches.get(0));
}
}

View File

@ -69,8 +69,8 @@ public class PomAssert {
try {
this.doc = XMLUnit.buildControlDocument(content);
}
catch (Exception e) {
throw new IllegalArgumentException("Cannot parse XML", e);
catch (Exception ex) {
throw new IllegalArgumentException("Cannot parse XML", ex);
}
this.parentPom = parseParent();
parseProperties();
@ -96,8 +96,8 @@ public class PomAssert {
assertThat(this.eng.evaluate(createRootNodeXPath("groupId"), this.doc))
.isEqualTo(groupId);
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
return this;
}
@ -107,8 +107,8 @@ public class PomAssert {
assertThat(this.eng.evaluate(createRootNodeXPath("artifactId"), this.doc))
.isEqualTo(artifactId);
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
return this;
}
@ -118,8 +118,8 @@ public class PomAssert {
assertThat(this.eng.evaluate(createRootNodeXPath("version"), this.doc))
.isEqualTo(version);
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
return this;
}
@ -129,8 +129,8 @@ public class PomAssert {
assertThat(this.eng.evaluate(createRootNodeXPath("packaging"), this.doc))
.isEqualTo(packaging);
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
return this;
}
@ -140,8 +140,8 @@ public class PomAssert {
assertThat(this.eng.evaluate(createRootNodeXPath("name"), this.doc))
.isEqualTo(name);
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
return this;
}
@ -151,8 +151,8 @@ public class PomAssert {
assertThat(this.eng.evaluate(createRootNodeXPath("description"), this.doc))
.isEqualTo(description);
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
return this;
}
@ -163,8 +163,8 @@ public class PomAssert {
this.eng.evaluate(createPropertyNodeXpath("java.version"), this.doc))
.isEqualTo(javaVersion);
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
return this;
}
@ -259,8 +259,8 @@ public class PomAssert {
.getMatchingNodes(createRootNodeXPath("repositories"), this.doc)
.getLength());
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
return this;
}
@ -283,8 +283,8 @@ public class PomAssert {
try {
assertThat(repository.getUrl()).isEqualTo(new URL(url));
}
catch (MalformedURLException e) {
throw new IllegalArgumentException("Cannot parse URL", e);
catch (MalformedURLException ex) {
throw new IllegalArgumentException("Cannot parse URL", ex);
}
}
if (snapshotsEnabled) {
@ -305,8 +305,8 @@ public class PomAssert {
createRootNodeXPath("pluginRepositories/pom:pluginRepository/pom:id"),
this.doc);
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
for (int i = 0; i < nodes.getLength(); i++) {
if (name.equals(nodes.item(i).getTextContent())) {
@ -335,8 +335,8 @@ public class PomAssert {
this.doc));
return parent;
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
}
@ -346,8 +346,8 @@ public class PomAssert {
nodes = this.eng.getMatchingNodes(createRootNodeXPath("properties/*"),
this.doc);
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
for (int i = 0; i < nodes.getLength(); i++) {
Node item = nodes.item(i);
@ -364,8 +364,8 @@ public class PomAssert {
nodes = this.eng.getMatchingNodes(
createRootNodeXPath("dependencies/pom:dependency"), this.doc);
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
for (int i = 0; i < nodes.getLength(); i++) {
Node item = nodes.item(i);
@ -407,8 +407,8 @@ public class PomAssert {
"dependencyManagement/pom:dependencies/pom:dependency"),
this.doc);
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
for (int i = 0; i < nodes.getLength(); i++) {
Node item = nodes.item(i);
@ -444,8 +444,8 @@ public class PomAssert {
nodes = this.eng.getMatchingNodes(
createRootNodeXPath("repositories/pom:repository"), this.doc);
}
catch (XpathException e) {
throw new IllegalStateException("Cannot find path", e);
catch (XpathException ex) {
throw new IllegalStateException("Cannot find path", ex);
}
for (int i = 0; i < nodes.getLength(); i++) {
@ -464,8 +464,8 @@ public class PomAssert {
try {
repository.setUrl(new URL(url.item(0).getTextContent()));
}
catch (MalformedURLException | DOMException e) {
throw new IllegalStateException("Cannot parse URL", e);
catch (MalformedURLException | DOMException ex) {
throw new IllegalStateException("Cannot parse URL", ex);
}
}
NodeList snapshots = element.getElementsByTagName("snapshots");

View File

@ -87,8 +87,8 @@ public class ProjectAssert {
return new PomAssert(StreamUtils.copyToString(
new FileInputStream(file("pom.xml")), Charset.forName("UTF-8")));
}
catch (IOException e) {
throw new IllegalArgumentException("Cannot resolve pom.xml", e);
catch (IOException ex) {
throw new IllegalArgumentException("Cannot resolve pom.xml", ex);
}
}
@ -101,8 +101,8 @@ public class ProjectAssert {
return new GradleBuildAssert(StreamUtils.copyToString(
new FileInputStream(file("build.gradle")), Charset.forName("UTF-8")));
}
catch (IOException e) {
throw new IllegalArgumentException("Cannot resolve build.gradle", e);
catch (IOException ex) {
throw new IllegalArgumentException("Cannot resolve build.gradle", ex);
}
}
@ -116,8 +116,8 @@ public class ProjectAssert {
StreamUtils.copyToString(new FileInputStream(file("settings.gradle")),
Charset.forName("UTF-8")));
}
catch (IOException e) {
throw new IllegalArgumentException("Cannot resolve settings.gradle", e);
catch (IOException ex) {
throw new IllegalArgumentException("Cannot resolve settings.gradle", ex);
}
}
@ -132,9 +132,9 @@ public class ProjectAssert {
return new SourceCodeAssert(sourceCodePath, StreamUtils.copyToString(
new FileInputStream(file(sourceCodePath)), Charset.forName("UTF-8")));
}
catch (IOException e) {
catch (IOException ex) {
throw new IllegalArgumentException("Cannot resolve path: " + sourceCodePath,
e);
ex);
}
}
@ -266,8 +266,8 @@ public class ProjectAssert {
try {
return PropertiesLoaderUtils.loadProperties(new FileSystemResource(f));
}
catch (Exception e) {
throw new IllegalStateException("Cannot load Properties", e);
catch (Exception ex) {
throw new IllegalStateException("Cannot load Properties", ex);
}
}

View File

@ -48,8 +48,8 @@ public class SourceCodeAssert {
assertThat(this.content).describedAs("Content for %s", this.name)
.isEqualTo(expectedContent.replaceAll("\r\n", "\n"));
}
catch (IOException e) {
throw new IllegalStateException("Cannot read file", e);
catch (IOException ex) {
throw new IllegalStateException("Cannot read file", ex);
}
return this;
}

View File

@ -232,8 +232,8 @@ public class InitializrMetadataTestBuilder {
try {
repo.setUrl(new URL(url));
}
catch (MalformedURLException e) {
throw new IllegalArgumentException("Cannot create URL", e);
catch (MalformedURLException ex) {
throw new IllegalArgumentException("Cannot create URL", ex);
}
repo.setSnapshotsEnabled(snapshotsEnabled);
it.getConfiguration().getEnv().getRepositories().put(id, repo);

View File

@ -77,7 +77,7 @@ public class InitializrAutoConfiguration {
public InitializrAutoConfiguration(
ObjectProvider<List<ProjectRequestPostProcessor>> postProcessors) {
List<ProjectRequestPostProcessor> list = postProcessors.getIfAvailable();
this.postProcessors = list != null ? list : new ArrayList<>();
this.postProcessors = (list != null ? list : new ArrayList<>());
}
@Bean

View File

@ -65,7 +65,7 @@ public class InitializrMetadataV21JsonMapper extends InitializrMetadataV2JsonMap
}
private ObjectNode dependenciesLink(String appUrl) {
String uri = appUrl != null ? appUrl + "/dependencies" : "/dependencies";
String uri = (appUrl != null ? appUrl + "/dependencies" : "/dependencies");
UriTemplate uriTemplate = new UriTemplate(uri, this.dependenciesVariables);
ObjectNode result = nodeFactory().objectNode();
result.put("href", uriTemplate.toString());

View File

@ -114,7 +114,7 @@ public class InitializrMetadataV2JsonMapper implements InitializrMetadataJsonMap
}
private String generateTemplatedUri(String appUrl, Type type) {
String uri = appUrl != null ? appUrl + type.getAction() : type.getAction();
String uri = (appUrl != null ? appUrl + type.getAction() : type.getAction());
uri = uri + "?type=" + type.getId();
UriTemplate uriTemplate = new UriTemplate(uri, this.templateVariables);
return uriTemplate.toString();

View File

@ -52,7 +52,7 @@ public abstract class AbstractInitializrController {
this.metadataProvider = metadataProvider;
this.linkTo = (link) -> {
String result = resourceUrlProvider.getForLookupPath(link);
return result == null ? link : result;
return (result != null ? result : link);
};
}

View File

@ -203,8 +203,8 @@ public class MainController extends AbstractInitializrController {
private ResponseEntity<String> dependenciesFor(InitializrMetadataVersion version,
String bootVersion) {
InitializrMetadata metadata = this.metadataProvider.get();
Version v = bootVersion != null ? Version.parse(bootVersion)
: Version.parse(metadata.getBootVersions().getDefault().getId());
Version v = (bootVersion != null ? Version.parse(bootVersion)
: Version.parse(metadata.getBootVersions().getDefault().getId()));
DependencyMetadata dependencyMetadata = this.dependencyMetadataProvider
.get(metadata, v);
String content = new DependencyMetadataV21JsonMapper().write(dependencyMetadata);
@ -324,15 +324,15 @@ public class MainController extends AbstractInitializrController {
try {
return URLEncoder.encode(tmp, "UTF-8") + "." + extension;
}
catch (UnsupportedEncodingException e) {
throw new IllegalStateException("Cannot encode URL", e);
catch (UnsupportedEncodingException ex) {
throw new IllegalStateException("Cannot encode URL", ex);
}
}
private static String getWrapperScript(ProjectRequest request) {
String script = "gradle".equals(request.getBuild()) ? "gradlew" : "mvnw";
return request.getBaseDir() != null ? request.getBaseDir() + "/" + script
: script;
String script = ("gradle".equals(request.getBuild()) ? "gradlew" : "mvnw");
return (request.getBaseDir() != null ? request.getBaseDir() + "/" + script
: script);
}
private ResponseEntity<byte[]> upload(File download, File dir, String fileName,

View File

@ -79,8 +79,8 @@ public class DefaultInitializrMetadataProvider implements InitializrMetadataProv
return new SpringBootMetadataReader(this.objectMapper, this.restTemplate,
url).getBootVersions();
}
catch (Exception e) {
log.warn("Failed to fetch spring boot metadata", e);
catch (Exception ex) {
log.warn("Failed to fetch spring boot metadata", ex);
}
}
return null;

View File

@ -57,7 +57,7 @@ public class UiController {
List<DependencyGroup> dependencyGroups = this.metadataProvider.get()
.getDependencies().getContent();
List<DependencyItem> content = new ArrayList<>();
Version v = StringUtils.isEmpty(version) ? null : Version.parse(version);
Version v = (StringUtils.isEmpty(version) ? null : Version.parse(version));
dependencyGroups.forEach((g) -> g.getContent().forEach((d) -> {
if (v != null && d.getVersionRange() != null) {
if (d.match(v)) {

View File

@ -48,7 +48,7 @@ public abstract class AbstractInitializrControllerIntegrationTests
@Override
protected String createUrl(String context) {
return context.startsWith("/") ? context : "/" + context;
return (context.startsWith("/") ? context : "/" + context);
}
public MockMvcClientHttpRequestFactory getRequests() {

View File

@ -226,8 +226,8 @@ public abstract class AbstractInitializrIntegrationTests {
}
return new ProjectAssert(project);
}
catch (Exception e) {
throw new IllegalStateException("Cannot unpack archive", e);
catch (Exception ex) {
throw new IllegalStateException("Cannot unpack archive", ex);
}
}
@ -277,7 +277,7 @@ public abstract class AbstractInitializrIntegrationTests {
return new JSONObject(content);
}
}
catch (Exception e) {
catch (Exception ex) {
throw new IllegalStateException("Cannot read JSON from path=" + path);
}
}

View File

@ -202,7 +202,7 @@ final class JsonFieldProcessor {
List<String> segments, Match parent) {
this.payload = payload;
this.path = path;
this.segments = segments == null ? path.getSegments() : segments;
this.segments = (segments != null ? segments : path.getSegments());
this.parent = parent;
}