ARTEMIS-3654 Fix AllClassesTest leaks

This commit is contained in:
Domenico Francesco Bruscino 2022-01-24 13:42:48 +01:00 committed by Bruscino Domenico Francesco
parent 8661cecb8f
commit b9243cc999
1 changed files with 12 additions and 2 deletions

View File

@ -90,8 +90,18 @@ public class AllClassesTest {
Assume.assumeTrue("Cannot create " + targetClass.getName(), targetInstance != null); Assume.assumeTrue("Cannot create " + targetClass.getName(), targetInstance != null);
String targetOutput = targetInstance.toString(); try {
log.debug("targetOutput: " + targetOutput); String targetOutput = targetInstance.toString();
log.debug("targetOutput: " + targetOutput);
} finally {
if (targetInstance instanceof AutoCloseable) {
try {
((AutoCloseable)targetInstance).close();
} catch (Throwable t) {
log.debug("Error closing the instance of " + targetClass.getName() + ": " + t);
}
}
}
} }
private Object newInstance(Class targetClass) { private Object newInstance(Class targetClass) {