Skip to content

Commit 1f1f08c

Browse files
committed
Changed Exception Type to IllegalArgumentException.
Issue: spring-projects#1392
1 parent 83350f9 commit 1f1f08c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: src/main/java/org/springframework/data/querydsl/SimpleEntityPathResolver.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
*
3232
* @author Oliver Gierke
3333
* @author Jens Schauder
34+
* @author Emanuel Trandafir
3435
*/
3536
public class SimpleEntityPathResolver implements EntityPathResolver {
3637

@@ -82,19 +83,22 @@ public <T> EntityPath<T> createPath(Class<T> domainClass) {
8283
}
8384

8485
/**
85-
* Resolves the static field of the given type inside the specified domain class.
86-
* Useful for handling Scala-generated QueryDSL path classes.
86+
* Resolves the static field of the given type inside the specified domain class. Useful for handling Scala-generated
87+
* QueryDSL path classes.
8788
*
8889
* @param domainClass The domain class for which the static field needs to be resolved.
8990
* @param javaPathClassName The Java path class name without the "$" suffix.
9091
* @return
9192
*/
9293
private <T> Optional<Field> getFieldForScalaObject(Class<T> domainClass, String javaPathClassName) {
9394
try {
95+
9496
Class<?> scalaPathClass = ClassUtils.forName(javaPathClassName + "$", domainClass.getClassLoader());
9597
return getStaticFieldOfType(scalaPathClass);
98+
9699
} catch (ClassNotFoundException e) {
97-
throw new RuntimeException(e);
100+
throw new IllegalArgumentException(
101+
String.format(NO_CLASS_FOUND_TEMPLATE, javaPathClassName + "$", domainClass.getName()), e);
98102
}
99103
}
100104

0 commit comments

Comments
 (0)