diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfiguration.java index 68c6c5122da5..8d7685abbffa 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 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. @@ -20,6 +20,7 @@ import java.util.Map; import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceException; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.binder.jpa.HibernateMetrics; @@ -69,8 +70,14 @@ public void bindEntityManagerFactoriesToRegistry( private void bindEntityManagerFactoryToRegistry(String beanName, EntityManagerFactory entityManagerFactory) { String entityManagerFactoryName = getEntityManagerFactoryName(beanName); - new HibernateMetrics(entityManagerFactory, entityManagerFactoryName, - Collections.emptyList()).bindTo(this.registry); + try { + new HibernateMetrics(entityManagerFactory.unwrap(SessionFactory.class), + entityManagerFactoryName, Collections.emptyList()) + .bindTo(this.registry); + } + catch (PersistenceException ex) { + // Continue + } } /** diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyEndpointIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyEndpointIntegrationTests.java index c6147eb632e5..d136bcd14717 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyEndpointIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/integrationtest/JerseyEndpointIntegrationTests.java @@ -56,7 +56,7 @@ public void actuatorEndpointsWhenUserProvidedResourceConfigBeanNotAvailable() { testJerseyEndpoints(new Class[] { EndpointsConfiguration.class }); } - protected void testJerseyEndpoints(Class[] userConfigurations) { + protected void testJerseyEndpoints(Class[] userConfigurations) { FilteredClassLoader classLoader = new FilteredClassLoader( DispatcherServlet.class); new WebApplicationContextRunner( diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurerIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurerIntegrationTests.java index 4a1f2c89b739..a45dc4b433da 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurerIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterRegistryConfigurerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 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. @@ -77,9 +77,7 @@ MeterBinder testBinder(Alpha thing) { @Bean MeterRegistryCustomizer testCustomizer() { - return (registry) -> { - registry.config().commonTags("testTag", "testValue"); - }; + return (registry) -> registry.config().commonTags("testTag", "testValue"); } @Bean diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchJestHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchJestHealthIndicatorTests.java index 82f2478051e9..bc9c90ab07a0 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchJestHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchJestHealthIndicatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 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. @@ -62,6 +62,7 @@ public void elasticsearchIsUp() throws IOException { } @Test + @SuppressWarnings("unchecked") public void elasticsearchWithYellowStatusIsUp() throws IOException { given(this.jestClient.execute(any(Action.class))) .willReturn(createJestResult(200, true, "yellow")); diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/neo4j/Neo4jHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/neo4j/Neo4jHealthIndicatorTests.java index e7e94d35d113..86fe565a002a 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/neo4j/Neo4jHealthIndicatorTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/neo4j/Neo4jHealthIndicatorTests.java @@ -77,7 +77,7 @@ public void neo4jUp() { @Test public void neo4jDown() { - CypherException cypherException = new CypherException("Error executing Cypher", + CypherException cypherException = new CypherException( "Neo.ClientError.Statement.SyntaxError", "Unable to execute invalid Cypher"); given(this.session.query(Neo4jHealthIndicator.CYPHER, Collections.emptyMap())) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java index 2bb4946cbf53..ebe6e6834714 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java @@ -134,7 +134,6 @@ protected Mono renderErrorView(ServerRequest request) { protected Mono renderErrorResponse(ServerRequest request) { boolean includeStackTrace = isIncludeStackTrace(request, MediaType.ALL); Map error = getErrorAttributes(request, includeStackTrace); - HttpStatus errorStatus = getHttpStatus(error); return ServerResponse.status(getHttpStatus(error)) .contentType(MediaType.APPLICATION_JSON_UTF8) .body(BodyInserters.fromObject(error)); diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java index c149bdac402e..820424e0c2e4 100644 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java +++ b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/GroovyCompiler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 the original author or authors. + * Copyright 2012-2019 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. @@ -307,7 +307,6 @@ public void call(SourceUnit source, GeneratorContext context, ClassNode classNod private static class MainClass { - @SuppressWarnings("unchecked") public static ClassNode get(CompilationUnit source) { return get(source.getAST().getClasses()); } diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java index 0d4b2f9ab924..b6391d265c33 100644 --- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java +++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/runner/AbstractApplicationContextRunnerTests.java @@ -152,13 +152,9 @@ public void runWithFailedContextShouldReturnFailedAssertableContext() { @Test public void runWithClassLoaderShouldSetClassLoaderOnContext() { get().withClassLoader(new FilteredClassLoader(Gson.class.getPackage().getName())) - .run((context) -> { - assertThatExceptionOfType(ClassNotFoundException.class) - .isThrownBy(() -> { - ClassUtils.forName(Gson.class.getName(), - context.getClassLoader()); - }); - }); + .run((context) -> assertThatExceptionOfType(ClassNotFoundException.class) + .isThrownBy(() -> ClassUtils.forName(Gson.class.getName(), + context.getClassLoader()))); } @Test diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java index d2e2a3d49c70..ece13f8fa3ce 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootJar.java @@ -55,9 +55,8 @@ public BootJar() { getMainSpec().with(this.bootInf); this.bootInf.into("classes", classpathFiles(File::isDirectory)); this.bootInf.into("lib", classpathFiles(File::isFile)); - this.bootInf.filesMatching("module-info.class", (details) -> { - details.setRelativePath(details.getRelativeSourcePath()); - }); + this.bootInf.filesMatching("module-info.class", + (details) -> details.setRelativePath(details.getRelativeSourcePath())); getRootSpec().eachFile((details) -> { String pathString = details.getRelativePath().getPathString(); if (pathString.startsWith("BOOT-INF/lib/") diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java index 9378dc386087..d33ea580ac9d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootWar.java @@ -54,9 +54,8 @@ public BootWar() { (copySpec) -> copySpec.from( (Callable>) () -> (this.providedClasspath != null) ? this.providedClasspath : Collections.emptyList())); - getRootSpec().filesMatching("module-info.class", (details) -> { - details.setRelativePath(details.getRelativeSourcePath()); - }); + getRootSpec().filesMatching("module-info.class", + (details) -> details.setRelativePath(details.getRelativeSourcePath())); getRootSpec().eachFile((details) -> { String pathString = details.getRelativePath().getPathString(); if ((pathString.startsWith("WEB-INF/lib/")