Skip to content

Commit 18f5abe

Browse files
committed
Handle UnsupportedOperationException in BeanFinalizer
1 parent 3908795 commit 18f5abe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/coditory/quark/context/BeanFinalizer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ private static void closeBean(Object bean, BeanDescriptor<?> descriptor, Method
3535
Object[] args = resolveArguments(method, context);
3636
method.invoke(bean, args);
3737
} catch (Exception e) {
38-
throw new BeanFinalizationException("Could not close bean: " + descriptor.toShortString() + " using method: " + simplifyMethodName(method), e);
38+
if (e instanceof UnsupportedOperationException) {
39+
log.debug("Bean {} threw UnsupportedOperationException from {}", descriptor.toShortString(), simplifyMethodName(method));
40+
} else {
41+
throw new BeanFinalizationException("Could not close bean: " + descriptor.toShortString() + " using method: " + simplifyMethodName(method), e);
42+
}
3943
}
4044
log.debug("Closed bean {} using method {} in {}", descriptor.toShortString(), simplifyMethodName(method), timer.measureAndFormat());
4145
}

0 commit comments

Comments
 (0)