2727import java .io .IOException ;
2828import java .io .InterruptedIOException ;
2929import java .net .SocketException ;
30- import java .util .ArrayList ;
31- import java .util .Collections ;
3230import java .util .List ;
31+ import java .util .Objects ;
3332
3433import io .reactivex .rxjava3 .exceptions .CompositeException ;
3534import io .reactivex .rxjava3 .exceptions .MissingBackpressureException ;
@@ -140,7 +139,7 @@ public void accept(@NonNull final Throwable throwable) {
140139 if (throwable instanceof UndeliverableException ) {
141140 // As UndeliverableException is a wrapper,
142141 // get the cause of it to get the "real" exception
143- actualThrowable = throwable .getCause ();
142+ actualThrowable = Objects . requireNonNull ( throwable .getCause () );
144143 } else {
145144 actualThrowable = throwable ;
146145 }
@@ -149,7 +148,7 @@ public void accept(@NonNull final Throwable throwable) {
149148 if (actualThrowable instanceof CompositeException ) {
150149 errors = ((CompositeException ) actualThrowable ).getExceptions ();
151150 } else {
152- errors = Collections . singletonList (actualThrowable );
151+ errors = List . of (actualThrowable );
153152 }
154153
155154 for (final Throwable error : errors ) {
@@ -213,41 +212,37 @@ protected void initACRA() {
213212 private void initNotificationChannels () {
214213 // Keep the importance below DEFAULT to avoid making noise on every notification update for
215214 // the main and update channels
216- final List <NotificationChannelCompat > notificationChannelCompats = new ArrayList <>();
217- notificationChannelCompats .add (new NotificationChannelCompat
218- .Builder (getString (R .string .notification_channel_id ),
215+ final List <NotificationChannelCompat > notificationChannelCompats = List .of (
216+ new NotificationChannelCompat .Builder (getString (R .string .notification_channel_id ),
219217 NotificationManagerCompat .IMPORTANCE_LOW )
220- .setName (getString (R .string .notification_channel_name ))
221- .setDescription (getString (R .string .notification_channel_description ))
222- .build ());
223-
224- notificationChannelCompats .add (new NotificationChannelCompat
225- .Builder (getString (R .string .app_update_notification_channel_id ),
218+ .setName (getString (R .string .notification_channel_name ))
219+ .setDescription (getString (R .string .notification_channel_description ))
220+ .build (),
221+ new NotificationChannelCompat
222+ .Builder (getString (R .string .app_update_notification_channel_id ),
226223 NotificationManagerCompat .IMPORTANCE_LOW )
227- .setName (getString (R .string .app_update_notification_channel_name ))
228- .setDescription (getString (R .string .app_update_notification_channel_description ))
229- .build ());
230-
231- notificationChannelCompats .add (new NotificationChannelCompat
232- .Builder (getString (R .string .hash_channel_id ),
224+ .setName (getString (R .string .app_update_notification_channel_name ))
225+ .setDescription (
226+ getString (R .string .app_update_notification_channel_description ))
227+ .build (),
228+ new NotificationChannelCompat .Builder (getString (R .string .hash_channel_id ),
233229 NotificationManagerCompat .IMPORTANCE_HIGH )
234- .setName (getString (R .string .hash_channel_name ))
235- .setDescription (getString (R .string .hash_channel_description ))
236- .build ());
237-
238- notificationChannelCompats .add (new NotificationChannelCompat
239- .Builder (getString (R .string .error_report_channel_id ),
230+ .setName (getString (R .string .hash_channel_name ))
231+ .setDescription (getString (R .string .hash_channel_description ))
232+ .build (),
233+ new NotificationChannelCompat .Builder (getString (R .string .error_report_channel_id ),
240234 NotificationManagerCompat .IMPORTANCE_LOW )
241- .setName (getString (R .string .error_report_channel_name ))
242- .setDescription (getString (R .string .error_report_channel_description ))
243- .build ());
244-
245- notificationChannelCompats .add (new NotificationChannelCompat
246- .Builder (getString (R .string .streams_notification_channel_id ),
247- NotificationManagerCompat .IMPORTANCE_DEFAULT )
248- .setName (getString (R .string .streams_notification_channel_name ))
249- .setDescription (getString (R .string .streams_notification_channel_description ))
250- .build ());
235+ .setName (getString (R .string .error_report_channel_name ))
236+ .setDescription (getString (R .string .error_report_channel_description ))
237+ .build (),
238+ new NotificationChannelCompat
239+ .Builder (getString (R .string .streams_notification_channel_id ),
240+ NotificationManagerCompat .IMPORTANCE_DEFAULT )
241+ .setName (getString (R .string .streams_notification_channel_name ))
242+ .setDescription (
243+ getString (R .string .streams_notification_channel_description ))
244+ .build ()
245+ );
251246
252247 final NotificationManagerCompat notificationManager = NotificationManagerCompat .from (this );
253248 notificationManager .createNotificationChannelsCompat (notificationChannelCompats );
0 commit comments