Skip to content

Commit 306d52d

Browse files
committed
Merge branch '3.1.x' into 3.2.x
Closes gh-39793
2 parents 730a81c + 16b6400 commit 306d52d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/build/BuildpackReference.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
1717
package org.springframework.boot.buildpack.platform.build;
1818

1919
import java.net.MalformedURLException;
20+
import java.net.URISyntaxException;
2021
import java.net.URL;
2122
import java.nio.file.Path;
2223
import java.nio.file.Paths;
@@ -51,11 +52,11 @@ Path asPath() {
5152
try {
5253
URL url = new URL(this.value);
5354
if (url.getProtocol().equals("file")) {
54-
return Paths.get(url.getPath());
55+
return Paths.get(url.toURI());
5556
}
5657
return null;
5758
}
58-
catch (MalformedURLException ex) {
59+
catch (MalformedURLException | URISyntaxException ex) {
5960
// not a URL, fall through to attempting to find a plain file path
6061
}
6162
try {

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/build/TarGzipBuildpackTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -61,9 +61,9 @@ void resolveWhenFilePathReturnsBuildpack() throws Exception {
6161
@Test
6262
void resolveWhenFileUrlReturnsBuildpack() throws Exception {
6363
Path compressedArchive = this.testTarGzip.createArchive();
64-
BuildpackReference reference = BuildpackReference.of("file://" + compressedArchive.toString());
64+
BuildpackReference reference = BuildpackReference.of(compressedArchive.toUri().toString());
6565
Buildpack buildpack = TarGzipBuildpack.resolve(this.resolverContext, reference);
66-
assertThat(buildpack).isNotNull();
66+
assertThat(buildpack).as("Buildpack %s resolved from reference %s", buildpack, reference).isNotNull();
6767
assertThat(buildpack.getCoordinates()).hasToString("example/[email protected]");
6868
this.testTarGzip.assertHasExpectedLayers(buildpack);
6969
}

0 commit comments

Comments
 (0)