@@ -36,16 +36,16 @@ public class BugsnagEvent {
3636 */
3737 protected BugsnagEvent (Configuration config , Throwable throwable ) {
3838 this (config , throwable , HandledState .newInstance (
39- HandledState .SeverityReasonType .REASON_HANDLED_EXCEPTION ), java . lang . Thread .currentThread (), null );
39+ HandledState .SeverityReasonType .REASON_HANDLED_EXCEPTION ), Thread .currentThread (), null );
4040 }
4141
4242 BugsnagEvent (Configuration config , Throwable throwable ,
43- HandledState handledState , java . lang . Thread currentThread ) {
43+ HandledState handledState , Thread currentThread ) {
4444 this (config , throwable , handledState , currentThread , null );
4545 }
4646
4747 BugsnagEvent (Configuration config , Throwable throwable ,
48- HandledState handledState , java . lang . Thread currentThread , FeatureFlagStore clientFeatureFlagStore ) {
48+ HandledState handledState , Thread currentThread , FeatureFlagStore clientFeatureFlagStore ) {
4949 this .config = config ;
5050 this .error = new BugsnagError (config , throwable );
5151 this .handledState = handledState ;
@@ -58,9 +58,11 @@ protected BugsnagEvent(Configuration config, Throwable throwable) {
5858 featureFlagStore .merge (clientFeatureFlagStore );
5959 }
6060
61- if (config .isSendThreads ()) {
61+ boolean sendThreads = config .getSendThreads () == ThreadSendPolicy .ALWAYS ||
62+ (config .getSendThreads () == ThreadSendPolicy .UNHANDLED_ONLY && handledState .isUnhandled ());
63+ if (sendThreads ) {
6264 Throwable exc = handledState .isUnhandled () ? throwable : null ;
63- Map <java . lang . Thread , StackTraceElement []> allStackTraces = java . lang . Thread .getAllStackTraces ();
65+ Map <Thread , StackTraceElement []> allStackTraces = Thread .getAllStackTraces ();
6466 threads = BugsnagThread .getLiveThreads (config , currentThread , allStackTraces , exc );
6567 } else {
6668 threads = null ;
0 commit comments