Skip to content

Commit

Permalink
Merge pull request #1937 from bugsnag/lemnik/remove-deprecated-config
Browse files Browse the repository at this point in the history
Remove deprecated `Configuration.launchCrashThresholdMs`
  • Loading branch information
lemnik authored Nov 15, 2023
2 parents 6faacec + 600b8d3 commit 6620cd3
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 60 deletions.
2 changes: 0 additions & 2 deletions bugsnag-android-core/api/bugsnag-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ public class com/bugsnag/android/Configuration : com/bugsnag/android/CallbackAwa
public fun getEnabledErrorTypes ()Lcom/bugsnag/android/ErrorTypes;
public fun getEnabledReleaseStages ()Ljava/util/Set;
public fun getEndpoints ()Lcom/bugsnag/android/EndpointConfiguration;
public fun getLaunchCrashThresholdMs ()J
public fun getLaunchDurationMillis ()J
public fun getLogger ()Lcom/bugsnag/android/Logger;
public fun getMaxBreadcrumbs ()I
Expand Down Expand Up @@ -214,7 +213,6 @@ public class com/bugsnag/android/Configuration : com/bugsnag/android/CallbackAwa
public fun setEnabledErrorTypes (Lcom/bugsnag/android/ErrorTypes;)V
public fun setEnabledReleaseStages (Ljava/util/Set;)V
public fun setEndpoints (Lcom/bugsnag/android/EndpointConfiguration;)V
public fun setLaunchCrashThresholdMs (J)V
public fun setLaunchDurationMillis (J)V
public fun setLogger (Lcom/bugsnag/android/Logger;)V
public fun setMaxBreadcrumbs (I)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ class ManifestConfigLoaderTest {
assertEquals(maxPersistedSessions, 128)
assertEquals(maxReportedThreads, 200)
assertTrue(sendLaunchCrashesSynchronously)
@Suppress("DEPRECATION")
assertEquals(launchCrashThresholdMs, 5000)
assertEquals(launchDurationMillis, 5000)
assertEquals("android", appType)
}
Expand Down Expand Up @@ -128,8 +126,6 @@ class ManifestConfigLoaderTest {
assertEquals(maxPersistedEvents, 52)
assertEquals(maxPersistedSessions, 64)
assertEquals(maxReportedThreads, 100)
@Suppress("DEPRECATION")
assertEquals(launchCrashThresholdMs, 7000)
assertEquals(launchDurationMillis, 7000)
assertFalse(sendLaunchCrashesSynchronously)
assertEquals("react-native", appType)
Expand All @@ -142,14 +138,12 @@ class ManifestConfigLoaderTest {
val data = Bundle().apply {
putString("com.bugsnag.android.API_KEY", "5d1ec5bd39a74caa1267142706a7fb21")
putBoolean("com.bugsnag.android.ENABLE_EXCEPTION_HANDLER", false)
putInt("com.bugsnag.android.LAUNCH_CRASH_THRESHOLD_MS", 8000)
}

val config = configLoader.load(data, null)

with(config) {
assertEquals("5d1ec5bd39a74caa1267142706a7fb21", apiKey)
assertEquals(8000, launchDurationMillis)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -215,28 +215,6 @@ public void setPersistenceDirectory(@Nullable File directory) {
impl.setPersistenceDirectory(directory);
}

/**
* Deprecated. Use {@link #getLaunchDurationMillis()} instead.
*/
@Deprecated
public long getLaunchCrashThresholdMs() {
getLogger().w("The launchCrashThresholdMs configuration option is deprecated "
+ "and will be removed in a future release. Please use "
+ "launchDurationMillis instead.");
return getLaunchDurationMillis();
}

/**
* Deprecated. Use {@link #setLaunchDurationMillis(long)} instead.
*/
@Deprecated
public void setLaunchCrashThresholdMs(long launchCrashThresholdMs) {
getLogger().w("The launchCrashThresholdMs configuration option is deprecated "
+ "and will be removed in a future release. Please use "
+ "launchDurationMillis instead.");
setLaunchDurationMillis(launchCrashThresholdMs);
}

/**
* Sets whether or not Bugsnag should send crashes synchronously that occurred during
* the application's launch period. By default this behavior is enabled.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ internal class ManifestConfigLoader {
private const val MAX_PERSISTED_EVENTS = "$BUGSNAG_NS.MAX_PERSISTED_EVENTS"
private const val MAX_PERSISTED_SESSIONS = "$BUGSNAG_NS.MAX_PERSISTED_SESSIONS"
private const val MAX_REPORTED_THREADS = "$BUGSNAG_NS.MAX_REPORTED_THREADS"
private const val LAUNCH_CRASH_THRESHOLD_MS = "$BUGSNAG_NS.LAUNCH_CRASH_THRESHOLD_MS"
private const val LAUNCH_DURATION_MILLIS = "$BUGSNAG_NS.LAUNCH_DURATION_MILLIS"
private const val SEND_LAUNCH_CRASHES_SYNCHRONOUSLY = "$BUGSNAG_NS.SEND_LAUNCH_CRASHES_SYNCHRONOUSLY"
private const val APP_TYPE = "$BUGSNAG_NS.APP_TYPE"
Expand Down Expand Up @@ -81,10 +80,6 @@ internal class ManifestConfigLoader {
maxPersistedEvents = data.getInt(MAX_PERSISTED_EVENTS, maxPersistedEvents)
maxPersistedSessions = data.getInt(MAX_PERSISTED_SESSIONS, maxPersistedSessions)
maxReportedThreads = data.getInt(MAX_REPORTED_THREADS, maxReportedThreads)
launchDurationMillis = data.getInt(
LAUNCH_CRASH_THRESHOLD_MS,
launchDurationMillis.toInt()
).toLong()
launchDurationMillis = data.getInt(
LAUNCH_DURATION_MILLIS,
launchDurationMillis.toInt()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,6 @@ public void persistUserValid() {
assertFalse(config.impl.getPersistUser());
}

@SuppressWarnings("deprecation")
@Test
public void launchCrashThresholdMsValid() {
config.setLaunchCrashThresholdMs(123456);
assertEquals(123456, config.impl.getLaunchDurationMillis());
}

@Test
public void launchDurationMillisValid() {
config.setLaunchDurationMillis(123456);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,6 @@ private ImmutableConfig createConfigWithReleaseStages(Configuration config,
return BugsnagTestUtils.convert(config);
}

@SuppressWarnings("deprecation")
@Test
public void testLaunchThresholdDeprecated() {
assertEquals(5000L, config.getLaunchCrashThresholdMs());

config.setLaunchCrashThresholdMs(-5);
assertEquals(5000, config.getLaunchCrashThresholdMs());

int expected = 1500;
config.setLaunchCrashThresholdMs(expected);
assertEquals(expected, config.getLaunchCrashThresholdMs());
}

@Test
public void testLaunchThreshold() {
assertEquals(5000L, config.getLaunchDurationMillis());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ internal class ImmutableConfigTest {
assertEquals(seed.endpoints, endpoints)

// behaviour
@Suppress("DEPRECATION") // tests deprecated option is set via launchDurationMillis
assertEquals(seed.launchCrashThresholdMs, launchDurationMillis)
assertEquals(seed.launchDurationMillis, launchDurationMillis)
assertTrue(sendLaunchCrashesSynchronously)
assertEquals(NoopLogger, seed.logger)
Expand Down Expand Up @@ -164,8 +162,6 @@ internal class ImmutableConfigTest {

// behaviour
assertEquals(7000, seed.launchDurationMillis)
@Suppress("DEPRECATION") // should be same as launchDurationMillis
assertEquals(7000, seed.launchCrashThresholdMs)
assertFalse(sendLaunchCrashesSynchronously)
assertEquals(NoopLogger, seed.logger)
assertEquals(37, seed.maxBreadcrumbs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal class LoadConfigurationKotlinScenario(
Pattern.compile(".*java.net.UnknownHostException.*"),
Pattern.compile(".*com.example.Custom.*")
)
testConfig.launchCrashThresholdMs = 10000
testConfig.launchDurationMillis = 10000
testConfig.maxBreadcrumbs = 1
testConfig.persistUser = false
testConfig.redactedKeys = setOf(Pattern.compile(".*filter_me_two.*"))
Expand Down

0 comments on commit 6620cd3

Please sign in to comment.