Skip to content

Commit 9249b0b

Browse files
committed
HV-763 Removing string based logging method
1 parent ad88c07 commit 9249b0b

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

engine/src/main/java/org/hibernate/validator/internal/util/logging/Log.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,6 @@ GroupDefinitionException getUnableToExpandDefaultGroupListException(@FormatWith(
244244
IllegalArgumentException getInvalidLengthOfParameterMetaDataListException(String executableName, int nbParameters, int listSize);
245245

246246
@Message(id = 63, value = "Unable to instantiate %s.")
247-
ValidationException getUnableToInstantiateException(String className, @Cause Exception e);
248-
249247
ValidationException getUnableToInstantiateException(@FormatWith(ClassObjectFormatter.class) Class<?> clazz, @Cause Exception e);
250248

251249
@Message(id = 64, value = "Unable to instantiate %1$s: %2$s.")

engine/src/main/java/org/hibernate/validator/internal/util/privilegedactions/ConstructorInstance.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public final class ConstructorInstance<T> implements PrivilegedAction<T> {
2929
private final Object[] initArgs;
3030

3131
public static <T> ConstructorInstance<T> action(Constructor<T> constructor, Object... initArgs) {
32-
return new ConstructorInstance<T>( constructor, initArgs );
32+
return new ConstructorInstance<>( constructor, initArgs );
3333
}
3434

3535
private ConstructorInstance(Constructor<T> constructor, Object... initArgs) {
@@ -42,17 +42,8 @@ public T run() {
4242
try {
4343
return constructor.newInstance( initArgs );
4444
}
45-
catch (InstantiationException e) {
46-
throw log.getUnableToInstantiateException( constructor.getName(), e );
47-
}
48-
catch (IllegalAccessException e) {
49-
throw log.getUnableToInstantiateException( constructor.getName(), e );
50-
}
51-
catch (InvocationTargetException e) {
52-
throw log.getUnableToInstantiateException( constructor.getName(), e );
53-
}
54-
catch (RuntimeException e) {
55-
throw log.getUnableToInstantiateException( constructor.getName(), e );
45+
catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
46+
throw log.getUnableToInstantiateException( constructor.getDeclaringClass(), e );
5647
}
5748
}
5849
}

0 commit comments

Comments
 (0)