This commit is contained in:
Stephane Nicoll 2020-01-01 08:41:11 +01:00
parent cdafc45e14
commit 945b118b0c
9 changed files with 21 additions and 23 deletions

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -76,8 +76,7 @@ public class ProjectRequestDocumentFactory {
} }
// Let's not rely on the resolved dependencies here // Let's not rely on the resolved dependencies here
List<String> dependencies = new ArrayList<>(); List<String> dependencies = new ArrayList<>(request.getDependencies());
dependencies.addAll(request.getDependencies());
List<String> validDependencies = dependencies.stream() List<String> validDependencies = dependencies.stream()
.filter((id) -> metadata.getDependencies().get(id) != null).collect(Collectors.toList()); .filter((id) -> metadata.getDependencies().get(id) != null).collect(Collectors.toList());
document.setDependencies(new DependencyInformation(validDependencies)); document.setDependencies(new DependencyInformation(validDependencies));

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -64,7 +64,7 @@ public class BuildSettings {
* *
* @param <B> builder type * @param <B> builder type
*/ */
public abstract static class Builder<B extends Builder> { public abstract static class Builder<B extends Builder<B>> {
private String group; private String group;

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -69,7 +69,7 @@ public class BulletedSection<T> implements Section {
* @param item the item to add * @param item the item to add
* @return this for method chaining * @return this for method chaining
*/ */
public BulletedSection addItem(T item) { public BulletedSection<T> addItem(T item) {
this.items.add(item); this.items.add(item);
return this; return this;
} }

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -133,12 +133,12 @@ public final class KotlinPropertyDeclaration implements Annotatable {
protected abstract T self(); protected abstract T self();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public AccessorBuilder getter() { public AccessorBuilder<T> getter() {
return new AccessorBuilder<>((T) this, (created) -> this.getter = created); return new AccessorBuilder<>((T) this, (created) -> this.getter = created);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public AccessorBuilder setter() { public AccessorBuilder<T> setter() {
return new AccessorBuilder<>((T) this, (created) -> this.setter = created); return new AccessorBuilder<>((T) this, (created) -> this.setter = created);
} }

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package io.spring.initializr.metadata;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -185,7 +186,7 @@ public final class InitializrMetadataBuilder {
private static final Log logger = LogFactory.getLog(ResourceInitializrMetadataCustomizer.class); private static final Log logger = LogFactory.getLog(ResourceInitializrMetadataCustomizer.class);
private static final Charset UTF_8 = Charset.forName("UTF-8"); private static final Charset UTF_8 = StandardCharsets.UTF_8;
private final Resource resource; private final Resource resource;

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,7 +26,7 @@ public interface InitializrMetadataCustomizer {
/** /**
* Customize the {@link InitializrMetadata}, updating or moving around capabilities * Customize the {@link InitializrMetadata}, updating or moving around capabilities
* before they are validated. * before they are validated.
* @param metadata the initalizr metadata * @param metadata the initializr metadata
*/ */
void customize(InitializrMetadata metadata); void customize(InitializrMetadata metadata);

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -143,8 +143,8 @@ public class InitializrAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
ProjectGenerationController projectGenerationController(InitializrMetadataProvider metadataProvider, ProjectGenerationController<ProjectRequest> projectGenerationController(
ApplicationContext applicationContext) { InitializrMetadataProvider metadataProvider, ApplicationContext applicationContext) {
ProjectGenerationInvoker<ProjectRequest> projectGenerationInvoker = new ProjectGenerationInvoker<>( ProjectGenerationInvoker<ProjectRequest> projectGenerationInvoker = new ProjectGenerationInvoker<>(
applicationContext, new DefaultProjectRequestToDescriptionConverter()); applicationContext, new DefaultProjectRequestToDescriptionConverter());
return new DefaultProjectGenerationController(metadataProvider, projectGenerationInvoker); return new DefaultProjectGenerationController(metadataProvider, projectGenerationInvoker);

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,7 +27,6 @@ import io.spring.initializr.web.support.Agent.AgentId;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.HttpMediaTypeNotAcceptableException;
import org.springframework.web.accept.ContentNegotiationStrategy; import org.springframework.web.accept.ContentNegotiationStrategy;
import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
@ -61,7 +60,7 @@ public class InitializrWebConfig implements WebMvcConfigurer {
private final UrlPathHelper urlPathHelper = new UrlPathHelper(); private final UrlPathHelper urlPathHelper = new UrlPathHelper();
@Override @Override
public List<MediaType> resolveMediaTypes(NativeWebRequest request) throws HttpMediaTypeNotAcceptableException { public List<MediaType> resolveMediaTypes(NativeWebRequest request) {
String path = this.urlPathHelper String path = this.urlPathHelper
.getPathWithinApplication(request.getNativeRequest(HttpServletRequest.class)); .getPathWithinApplication(request.getNativeRequest(HttpServletRequest.class));
if (!StringUtils.hasText(path) || !path.equals("/")) { // Only care about "/" if (!StringUtils.hasText(path) || !path.equals("/")) { // Only care about "/"

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -283,8 +283,7 @@ public class CommandLineHelpGenerator {
private static List<String[]> computeRow(String[][] content, int rowIndex, int maxWidth) { private static List<String[]> computeRow(String[][] content, int rowIndex, int maxWidth) {
String[] line = content[rowIndex]; String[] line = content[rowIndex];
List<String[]> row = HelpFormatter.format(line, maxWidth); return HelpFormatter.format(line, maxWidth);
return row;
} }
private static void appendEmptyRow(StringBuilder sb, int[] columnsLength) { private static void appendEmptyRow(StringBuilder sb, int[] columnsLength) {