Skip to content

Commit

Permalink
Merge pull request #19000 from thelproad
Browse files Browse the repository at this point in the history
* pr/19000:
  Remove redundant code

Closes gh-19000
  • Loading branch information
snicoll committed Nov 23, 2019
2 parents 0c5bb60 + 65ab82b commit 36f4d2f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
Expand Up @@ -190,7 +190,7 @@ public void customize(JettyServletWebServerFactory factory) {

private void customizeServer(Server server) {
RequestLog requestLog = server.getRequestLog();
if (requestLog != null && requestLog instanceof CustomRequestLog) {
if (requestLog instanceof CustomRequestLog) {
customizeRequestLog((CustomRequestLog) requestLog);
}
}
Expand Down
Expand Up @@ -51,7 +51,7 @@ public class EndpointMediaTypes {
* @since 2.2.0
*/
public EndpointMediaTypes(String... producedAndConsumed) {
this((producedAndConsumed != null) ? Arrays.asList(producedAndConsumed) : (List<String>) null);
this((producedAndConsumed != null) ? Arrays.asList(producedAndConsumed) : null);
}

/**
Expand Down
Expand Up @@ -279,7 +279,7 @@ protected final <T> List<T> removeDuplicates(List<T> list) {

protected final List<String> asList(AnnotationAttributes attributes, String name) {
String[] value = attributes.getStringArray(name);
return Arrays.asList((value != null) ? value : new String[0]);
return Arrays.asList(value);
}

private void fireAutoConfigurationImportEvents(List<String> configurations, Set<String> exclusions) {
Expand Down
Expand Up @@ -24,7 +24,6 @@
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.Assert;
Expand All @@ -39,14 +38,11 @@
@Order(Ordered.HIGHEST_PRECEDENCE + 20)
class OnResourceCondition extends SpringBootCondition {

private final ResourceLoader defaultResourceLoader = new DefaultResourceLoader();

@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
MultiValueMap<String, Object> attributes = metadata
.getAllAnnotationAttributes(ConditionalOnResource.class.getName(), true);
ResourceLoader loader = (context.getResourceLoader() != null) ? context.getResourceLoader()
: this.defaultResourceLoader;
ResourceLoader loader = context.getResourceLoader();
List<String> locations = new ArrayList<>();
collectValues(locations, attributes.get("resources"));
Assert.isTrue(!locations.isEmpty(),
Expand Down

0 comments on commit 36f4d2f

Please sign in to comment.