ARTEMIS-3654 Fix AllClassesTest leaks
This commit is contained in:
parent
8661cecb8f
commit
b9243cc999
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue