From 672c6314bd223c2e6d9f6ad3e1f9c9a37416897a Mon Sep 17 00:00:00 2001 From: Scott Frederick Date: Fri, 22 Mar 2024 12:02:19 -0500 Subject: [PATCH] Polish See gh-36033 --- .../boot/io/Base64ProtocolResolver.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/io/Base64ProtocolResolver.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/io/Base64ProtocolResolver.java index f2bc4811e9e1..bfdd3962adbe 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/io/Base64ProtocolResolver.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/io/Base64ProtocolResolver.java @@ -35,17 +35,14 @@ class Base64ProtocolResolver implements ProtocolResolver { @Override public Resource resolve(String location, ResourceLoader resourceLoader) { if (location.startsWith(BASE64_PREFIX)) { - return new Base64ByteArrayResource(location.substring(BASE64_PREFIX.length())); + String value = location.substring(BASE64_PREFIX.length()); + return new ByteArrayResource(decode(value)); } return null; } - static class Base64ByteArrayResource extends ByteArrayResource { - - Base64ByteArrayResource(String location) { - super(Base64.getDecoder().decode(location.getBytes())); - } - + private static byte[] decode(String location) { + return Base64.getDecoder().decode(location); } }