Merge org.hibernate.testing.orm.ExceptionHelper into org.hibernate.internal.util.ExceptionHelper

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2023-03-17 14:36:33 +01:00 committed by Jan Schatteman
parent 575847322d
commit 42f64f1c2e
2 changed files with 9 additions and 1 deletions

View File

@ -21,6 +21,14 @@ public final class ExceptionHelper {
ExceptionHelper.<RuntimeException>doThrow0(e);
}
public static Throwable getRootCause(Throwable error) {
Throwable toProcess = error;
while ( toProcess.getCause() != null ) {
toProcess = toProcess.getCause();
}
return toProcess;
}
@SuppressWarnings("unchecked")
private static <T extends Throwable> void doThrow0(Throwable e) throws T {
throw (T) e;

View File

@ -18,10 +18,10 @@ import jakarta.persistence.Id;
import jakarta.persistence.Table;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.internal.util.ExceptionHelper;
import org.hibernate.query.Query;
import org.hibernate.sql.ast.SqlTreeCreationException;
import org.hibernate.testing.orm.ExceptionHelper;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;