From 80a20488fde461a54a90628daf1d8a8c68bec107 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 4 Jul 2023 16:38:10 +0200 Subject: [PATCH 1/2] Make File/Path tests pass on Windows See gh-30806 --- .../java/org/springframework/util/ObjectUtilsTests.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java b/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java index 025c3a99f5c..1bbd0f9e92d 100644 --- a/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java @@ -937,10 +937,10 @@ class ObjectUtilsTests { @Test void nullSafeConciseToStringForFile() { - String path = "/tmp/file.txt"; + String path = "/tmp/file.txt".replace('/', File.separatorChar); assertThat(ObjectUtils.nullSafeConciseToString(new File(path))).isEqualTo(path); - path = "/tmp/" + "xyz".repeat(32); + path = ("/tmp/" + "xyz".repeat(32)).replace('/', File.separatorChar); assertThat(ObjectUtils.nullSafeConciseToString(new File(path))) .hasSize(truncatedLength) .startsWith(path.subSequence(0, 100)) @@ -949,10 +949,10 @@ class ObjectUtilsTests { @Test void nullSafeConciseToStringForPath() { - String path = "/tmp/file.txt"; + String path = "/tmp/file.txt".replace('/', File.separatorChar); assertThat(ObjectUtils.nullSafeConciseToString(Path.of(path))).isEqualTo(path); - path = "/tmp/" + "xyz".repeat(32); + path = ("/tmp/" + "xyz".repeat(32)).replace('/', File.separatorChar); assertThat(ObjectUtils.nullSafeConciseToString(Path.of(path))) .hasSize(truncatedLength) .startsWith(path.subSequence(0, 100)) From f07b9fd21706e61ef46eb442ea3ceb6df15ec7e8 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 4 Jul 2023 16:52:44 +0200 Subject: [PATCH 2/2] Polishing --- .../main/java/org/springframework/core/io/PathResource.java | 2 +- .../web/reactive/function/client/ExchangeFunction.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/io/PathResource.java b/spring-core/src/main/java/org/springframework/core/io/PathResource.java index c4a4168b2ee..b4edc9bbf47 100644 --- a/spring-core/src/main/java/org/springframework/core/io/PathResource.java +++ b/spring-core/src/main/java/org/springframework/core/io/PathResource.java @@ -303,7 +303,7 @@ public class PathResource extends AbstractResource implements WritableResource { } /** - * This implementation returns the hash code of the underlying Path reference. + * This implementation returns the hash code of the underlying {@link Path} reference. */ @Override public int hashCode() { diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFunction.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFunction.java index c5325284a64..661310b769d 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFunction.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeFunction.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2023 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. @@ -43,12 +43,11 @@ public interface ExchangeFunction { /** * Exchange the given request for a {@link ClientResponse} promise. - * *

Note: When calling this method from an * {@link ExchangeFilterFunction} that handles the response in some way, * extra care must be taken to always consume its content or otherwise * propagate it downstream for further handling, for example by the - * {@link WebClient}. Please, see the reference documentation for more + * {@link WebClient}. Please see the reference documentation for more * details on this. * @param request the request to exchange * @return the delayed response