Skip to content

Commit 5ac4c3b

Browse files
PiotrFLEURYsnicoll
authored andcommitted
Provide invalid class name in exception message
See gh-31612
1 parent 05c3ffb commit 5ac4c3b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

spring-core/src/main/java/org/springframework/aot/generate/GeneratedFiles.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ default void addFile(Kind kind, String path, ThrowingConsumer<Appendable> conten
161161

162162
private static String getClassNamePath(String className) {
163163
Assert.hasLength(className, "'className' must not be empty");
164-
Assert.isTrue(isJavaIdentifier(className), "'className' must be a valid identifier");
164+
Assert.isTrue(isJavaIdentifier(className), "'className' " + className + " must be a valid identifier");
165165
return ClassUtils.convertClassNameToResourcePath(className) + ".java";
166166
}
167167

spring-core/src/test/java/org/springframework/aot/generate/GeneratedFilesTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void addSourceFileWithCharSequenceWhenClassNameIsInvalidThrowsException() {
7878
assertThatIllegalArgumentException()
7979
.isThrownBy(() -> this.generatedFiles
8080
.addSourceFile("com/example/HelloWorld.java", "{}"))
81-
.withMessage("'className' must be a valid identifier");
81+
.withMessage("'className' com/example/HelloWorld.java must be a valid identifier");
8282
}
8383

8484
@Test

0 commit comments

Comments
 (0)