From 0fd1c89889d7c7a8cb70618854d9499519429593 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 16 Jun 2023 13:53:33 -0700 Subject: [PATCH] Polish --- .../boot/context/properties/bind/JavaBeanBinder.java | 8 +++----- .../boot/image/assertions/ContainerConfigAssert.java | 11 +++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/JavaBeanBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/JavaBeanBinder.java index 4134cc58e4..44af313086 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/JavaBeanBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/JavaBeanBinder.java @@ -392,11 +392,9 @@ class JavaBeanBinder implements DataObjectBinder { } private boolean isUninitializedKotlinProperty(Exception ex) { - if (ex instanceof InvocationTargetException ite) { - return "kotlin.UninitializedPropertyAccessException" - .equals(ite.getTargetException().getClass().getName()); - } - return false; + return (ex instanceof InvocationTargetException invocationTargetException) + && "kotlin.UninitializedPropertyAccessException" + .equals(invocationTargetException.getTargetException().getClass().getName()); } boolean isSettable() { diff --git a/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/assertions/ContainerConfigAssert.java b/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/assertions/ContainerConfigAssert.java index e8dffb4b16..3c0368813b 100644 --- a/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/assertions/ContainerConfigAssert.java +++ b/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/assertions/ContainerConfigAssert.java @@ -16,6 +16,7 @@ package org.springframework.boot.image.assertions; +import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; @@ -106,8 +107,14 @@ public class ContainerConfigAssert extends AbstractAssert (list != null) ? ((List) list).stream().map(Objects::toString).toList() - : Collections.emptyList()); + .flatMap(this::getArgs); + } + + private Collection getArgs(Object obj) { + if (obj instanceof List list) { + return list.stream().map(Objects::toString).toList(); + } + return Collections.emptyList(); } }