Skip to content

Commit

Permalink
Handle UnsupportedOperationException in BeanFinalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
ogesaku committed Feb 12, 2024
1 parent 3908795 commit 18f5abe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/coditory/quark/context/BeanFinalizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ private static void closeBean(Object bean, BeanDescriptor<?> descriptor, Method
Object[] args = resolveArguments(method, context);
method.invoke(bean, args);
} catch (Exception e) {
throw new BeanFinalizationException("Could not close bean: " + descriptor.toShortString() + " using method: " + simplifyMethodName(method), e);
if (e instanceof UnsupportedOperationException) {
log.debug("Bean {} threw UnsupportedOperationException from {}", descriptor.toShortString(), simplifyMethodName(method));
} else {
throw new BeanFinalizationException("Could not close bean: " + descriptor.toShortString() + " using method: " + simplifyMethodName(method), e);
}
}
log.debug("Closed bean {} using method {} in {}", descriptor.toShortString(), simplifyMethodName(method), timer.measureAndFormat());
}
Expand Down

0 comments on commit 18f5abe

Please sign in to comment.