Skip to content

Commit e94ddfa

Browse files
committed
Polish "Explicit error message if source is not an archive"
See gh-31997
1 parent a0f273a commit e94ddfa

File tree

2 files changed

+4
-4
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src

2 files changed

+4
-4
lines changed

spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/main/java/org/springframework/boot/jarmode/layertools/Context.java

Lines changed: 2 additions & 2 deletions
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-2022 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.
@@ -56,7 +56,7 @@ class Context {
5656
*/
5757
Context(File archiveFile, File workingDir) {
5858
Assert.state(isExistingFile(archiveFile), "Unable to find source archive");
59-
Assert.state(isJarOrWar(archiveFile), "Source archive doesn't end with .jar or .war");
59+
Assert.state(isJarOrWar(archiveFile), "Source archive " + archiveFile + " must end with .jar or .war");
6060
this.archiveFile = archiveFile;
6161
this.workingDir = workingDir;
6262
this.relativeDir = deduceRelativeDir(archiveFile.getParentFile(), this.workingDir);

spring-boot-project/spring-boot-tools/spring-boot-jarmode-layertools/src/test/java/org/springframework/boot/jarmode/layertools/ContextTests.java

Lines changed: 2 additions & 2 deletions
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-2022 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.
@@ -55,7 +55,7 @@ void createWhenSourceIsNotJarOrWarThrowsException() throws Exception {
5555
File zip = new File(this.temp, "test.zip");
5656
Files.createFile(zip.toPath());
5757
assertThatIllegalStateException().isThrownBy(() -> new Context(zip, this.temp))
58-
.withMessage("Unable to find source archive");
58+
.withMessageContaining("test.zip must end with .jar or .war");
5959
}
6060

6161
@Test

0 commit comments

Comments
 (0)