Close factory when creation fails

Closes #16671
This commit is contained in:
Alexander Schwartz 2023-03-08 10:23:49 +01:00 committed by Michal Hajas
parent 6086201fe0
commit d210980988

View file

@ -344,9 +344,14 @@ public abstract class KeycloakModelTest {
return "KeycloakSessionFactory " + factoryIndex + " (from " + threadName + " thread)";
}
};
res.init();
res.publish(new PostMigrationEvent(res));
return res;
try {
res.init();
res.publish(new PostMigrationEvent(res));
return res;
} catch (RuntimeException ex) {
res.close();
throw ex;
}
}
/**