File tree Expand file tree Collapse file tree
app/src/main/java/org/schabi/newpipe Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ class AboutActivity : AppCompatActivity() {
9292 return when (position) {
9393 posAbout -> AboutFragment ()
9494 posLicense -> LicenseFragment .newInstance(SOFTWARE_COMPONENTS )
95- else -> throw IllegalArgumentException (" Unknown position for ViewPager2" )
95+ else -> error (" Unknown position for ViewPager2" )
9696 }
9797 }
9898
@@ -105,7 +105,7 @@ class AboutActivity : AppCompatActivity() {
105105 return when (position) {
106106 posAbout -> R .string.tab_about
107107 posLicense -> R .string.tab_licenses
108- else -> throw IllegalArgumentException (" Unknown position for ViewPager2" )
108+ else -> error (" Unknown position for ViewPager2" )
109109 }
110110 }
111111 }
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ abstract class StreamDAO : BasicDAO<StreamEntity> {
8787
8888 private fun compareAndUpdateStream (newerStream : StreamEntity ) {
8989 val existentMinimalStream = getMinimalStreamForCompare(newerStream.serviceId, newerStream.url)
90- ? : throw IllegalStateException (" Stream cannot be null just after insertion." )
90+ ? : error (" Stream cannot be null just after insertion." )
9191 newerStream.uid = existentMinimalStream.uid
9292
9393 if (! StreamTypeUtil .isLiveStream(newerStream.streamType)) {
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ abstract class SubscriptionDAO : BasicDAO<SubscriptionEntity> {
100100 entity.uid = uidFromInsert
101101 } else {
102102 val subscriptionIdFromDb = getSubscriptionIdInternal(entity.serviceId, entity.url!! )
103- ? : throw IllegalStateException (" Subscription cannot be null just after insertion." )
103+ ? : error (" Subscription cannot be null just after insertion." )
104104 entity.uid = subscriptionIdFromDb
105105
106106 update(entity)
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ internal fun infoItemTypeToString(type: InfoType): String {
2222 InfoType .STREAM -> ID_STREAM
2323 InfoType .PLAYLIST -> ID_PLAYLIST
2424 InfoType .CHANNEL -> ID_CHANNEL
25- else -> throw IllegalStateException (" Unexpected value: $type " )
25+ else -> error (" Unexpected value: $type " )
2626 }
2727}
2828
@@ -31,7 +31,7 @@ internal fun infoItemTypeFromString(type: String): InfoType {
3131 ID_STREAM -> InfoType .STREAM
3232 ID_PLAYLIST -> InfoType .PLAYLIST
3333 ID_CHANNEL -> InfoType .CHANNEL
34- else -> throw IllegalStateException (" Unexpected value: $type " )
34+ else -> error (" Unexpected value: $type " )
3535 }
3636}
3737
Original file line number Diff line number Diff line change @@ -82,11 +82,11 @@ internal class PackageValidator(context: Context) {
8282
8383 // Build the caller info for the rest of the checks here.
8484 val callerPackageInfo = buildCallerInfo(callingPackage)
85- ? : throw IllegalStateException (" Caller wasn't found in the system?" )
85+ ? : error (" Caller wasn't found in the system?" )
8686
8787 // Verify that things aren't ... broken. (This test should always pass.)
88- if (callerPackageInfo.uid != callingUid) {
89- throw IllegalStateException ( " Caller's package UID doesn't match caller's actual UID?" )
88+ check (callerPackageInfo.uid != callingUid) {
89+ " Caller's package UID doesn't match caller's actual UID?"
9090 }
9191
9292 val callerSignature = callerPackageInfo.signature
@@ -202,7 +202,7 @@ internal class PackageValidator(context: Context) {
202202 */
203203 private fun getSystemSignature (): String = getPackageInfo(ANDROID_PLATFORM )?.let { platformInfo ->
204204 getSignature(platformInfo)
205- } ? : throw IllegalStateException (" Platform signature not found" )
205+ } ? : error (" Platform signature not found" )
206206
207207 /* *
208208 * Creates a SHA-256 signature given a certificate byte array.
You can’t perform that action at this time.
0 commit comments