Merge branch '3.0.x' into 3.1.x
Closes gh-37570
This commit is contained in:
commit
02f71d8e95
1
.idea/inspectionProfiles/Project_Default.xml
generated
1
.idea/inspectionProfiles/Project_Default.xml
generated
@ -1,6 +1,7 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="LombokGetterMayBeUsed" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="UnqualifiedFieldAccess" enabled="true" level="ERROR" enabled_by_default="true" editorAttributes="ERRORS_ATTRIBUTES" />
|
||||
</profile>
|
||||
</component>
|
@ -228,6 +228,9 @@ public class StandardConfigDataLocationResolver
|
||||
return Collections.singleton(reference);
|
||||
}
|
||||
}
|
||||
if (configDataLocation.isOptional()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
throw new IllegalStateException("File extension is not known to any PropertySourceLoader. "
|
||||
+ "If the location is meant to reference a directory, it must end in '/' or File.separator");
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ import static org.mockito.Mockito.mock;
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
* @author Phillip Webb
|
||||
* @author Moritz Halbritter
|
||||
*/
|
||||
class StandardConfigDataLocationResolverTests {
|
||||
|
||||
@ -263,6 +264,26 @@ class StandardConfigDataLocationResolverTests {
|
||||
assertThat(locations).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void resolveWhenOptionalAndLoaderIsUnknownShouldNotFail() {
|
||||
ConfigDataLocation location = ConfigDataLocation.of("optional:some-unknown-loader:dummy.properties");
|
||||
assertThatNoException().isThrownBy(() -> this.resolver.resolve(this.context, location));
|
||||
}
|
||||
|
||||
@Test
|
||||
void resolveWhenOptionalAndLoaderIsUnknownAndExtensionIsUnknownShouldNotFail() {
|
||||
ConfigDataLocation location = ConfigDataLocation
|
||||
.of("optional:some-unknown-loader:dummy.some-unknown-extension");
|
||||
List<StandardConfigDataResource> locations = this.resolver.resolve(this.context, location);
|
||||
assertThatNoException().isThrownBy(() -> this.resolver.resolve(this.context, location));
|
||||
}
|
||||
|
||||
@Test
|
||||
void resolveWhenOptionalAndExtensionIsUnknownShouldNotFail() {
|
||||
ConfigDataLocation location = ConfigDataLocation.of("optional:file:dummy.some-unknown-extension");
|
||||
assertThatNoException().isThrownBy(() -> this.resolver.resolve(this.context, location));
|
||||
}
|
||||
|
||||
private String filePath(String... components) {
|
||||
return "file [" + String.join(File.separator, components) + "]";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user