Skip to content

Commit

Permalink
Merge pull request #210 from bugsnag/release/v2.5.0
Browse files Browse the repository at this point in the history
Release/v2.5.0
  • Loading branch information
robert-smartbear authored Jul 17, 2023
2 parents 8d756ed + 06ef1f3 commit 800db33
Show file tree
Hide file tree
Showing 14 changed files with 160 additions and 85 deletions.
8 changes: 4 additions & 4 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ steps:
- "--farm=bs"
- "--device=IOS_14"
- "--fail-fast"
concurrency: 24
concurrency: 5
concurrency_group: 'browserstack-app'
concurrency_method: eager

Expand All @@ -132,7 +132,7 @@ steps:
- "--farm=bs"
- "--device=IOS_14"
- "--fail-fast"
concurrency: 24
concurrency: 5
concurrency_group: 'browserstack-app'
concurrency_method: eager

Expand Down Expand Up @@ -184,7 +184,7 @@ steps:
- "--farm=bs"
- "--device=ANDROID_12_0"
- "--fail-fast"
concurrency: 24
concurrency: 5
concurrency_group: 'browserstack-app'
concurrency_method: eager

Expand All @@ -207,6 +207,6 @@ steps:
- "--farm=bs"
- "--device=ANDROID_12_0"
- "--fail-fast"
concurrency: 24
concurrency: 5
concurrency_group: 'browserstack-app'
concurrency_method: eager
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 2.5.0 (2023-07-17)

- Additional null safety checks in BugsnagFlutter.java [#209](https://github.com/bugsnag/bugsnag-flutter/pull/209)
- Update bugsnag-cocoa from v6.25.0 to [v6.26.2](https://github.com/bugsnag/bugsnag-cocoa/blob/master/CHANGELOG.md#6262-2023-04-20)
- Update bugsnag-android from v5.28.3 to [v5.30.0](https://github.com/bugsnag/bugsnag-android/blob/master/CHANGELOG.md#5300-2023-05-11)
- Prevent crashing if the stack trace is empty
[#204](https://github.com/bugsnag/bugsnag-flutter/pull/204)
- Include breadcrumb metadata in sanitizing (allows enums in metadata)
[#206](https://github.com/bugsnag/bugsnag-flutter/pull/206)

## 2.4.0 (2022-12-01)

- Added `maxStringValueLength` option to `bugsnag.start` to allow truncation behaviour to be configured.
Expand Down
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ GEM
appium_lib_core (4.7.1)
faye-websocket (~> 0.11.0)
selenium-webdriver (~> 3.14, >= 3.14.1)
bugsnag (6.24.2)
bugsnag (6.25.2)
concurrent-ruby (~> 1.0)
builder (3.2.4)
childprocess (3.0.0)
concurrent-ruby (1.1.10)
concurrent-ruby (1.2.2)
cucumber (7.1.0)
builder (~> 3.2, >= 3.2.4)
cucumber-core (~> 10.1, >= 10.1.0)
Expand Down Expand Up @@ -66,28 +66,28 @@ GEM
curb (0.9.11)
diff-lcs (1.5.0)
eventmachine (1.2.7)
faye-websocket (0.11.1)
faye-websocket (0.11.2)
eventmachine (>= 0.12.0)
websocket-driver (>= 0.5.1)
ffi (1.15.5)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105)
mime-types-data (3.2023.0218.1)
multi_test (0.1.2)
nokogiri (1.13.4-x86_64-darwin)
nokogiri (1.15.3-x86_64-darwin)
racc (~> 1.4)
optimist (3.0.1)
os (1.0.1)
power_assert (2.0.1)
racc (1.6.0)
power_assert (2.0.3)
racc (1.7.1)
rake (12.3.3)
rubyzip (2.3.2)
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
sys-uname (1.2.2)
sys-uname (1.2.3)
ffi (~> 1.1)
test-unit (3.5.3)
test-unit (3.5.9)
power_assert
tomlrb (1.3.0)
webrick (1.7.0)
Expand All @@ -102,4 +102,4 @@ DEPENDENCIES
bugsnag-maze-runner!

BUNDLED WITH
2.3.11
2.4.8
2 changes: 1 addition & 1 deletion packages/bugsnag_breadcrumbs_dart_io/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: bugsnag_breadcrumbs_dart_io
description: Bugsnag network breadcrumbs for dart:io's HttpClient
version: 2.4.0
version: 2.5.0
homepage: https://www.bugsnag.com/
documentation: https://docs.bugsnag.com/platforms/flutter/
repository: https://github.com/bugsnag/bugsnag-flutter
Expand Down
2 changes: 1 addition & 1 deletion packages/bugsnag_breadcrumbs_http/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: bugsnag_breadcrumbs_http
description: Bugsnag network breadcrumbs for https://pub.dev/packages/http
version: 2.4.0
version: 2.5.0
homepage: https://www.bugsnag.com/
documentation: https://docs.bugsnag.com/platforms/flutter/
repository: https://github.com/bugsnag/bugsnag-flutter
Expand Down
6 changes: 5 additions & 1 deletion packages/bugsnag_flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 29

if (android.hasProperty('namespace')) {
namespace 'com.bugsnag.flutter'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -46,7 +50,7 @@ android {
}

dependencies {
implementation 'com.bugsnag:bugsnag-android:5.28.3'
implementation 'com.bugsnag:bugsnag-android:5.30.0'
testImplementation 'junit:junit:4.12'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class BugsnagFlutter {

Context context;

JSONObject attach(@NonNull JSONObject args) throws Exception {
JSONObject attach(@Nullable JSONObject args) throws Exception {
JSONObject result = new JSONObject()
.put("config", new JSONObject()
.put("enabledErrorTypes", new JSONObject()
Expand All @@ -71,18 +71,20 @@ JSONObject attach(@NonNull JSONObject args) throws Exception {

client = new InternalHooks(nativeClient);

Notifier notifier = client.getNotifier();
JSONObject notifierJson = args.getJSONObject("notifier");
notifier.setName(notifierJson.getString("name"));
notifier.setVersion(notifierJson.getString("version"));
notifier.setUrl(notifierJson.getString("url"));
notifier.setDependencies(Collections.singletonList(new Notifier()));
if (args != null && args.has("notifier")) {
Notifier notifier = client.getNotifier();
JSONObject notifierJson = args.getJSONObject("notifier");
notifier.setName(notifierJson.getString("name"));
notifier.setVersion(notifierJson.getString("version"));
notifier.setUrl(notifierJson.getString("url"));
notifier.setDependencies(Collections.singletonList(new Notifier()));
}

isAttached = true;
return result;
}

Void start(@NonNull JSONObject args) throws Exception {
Void start(@Nullable JSONObject args) throws Exception {
if (isStarted) {
Log.w("BugsnagFlutter", "bugsnag.start() was called more than once. Ignoring.");
return null;
Expand All @@ -96,38 +98,39 @@ Void start(@NonNull JSONObject args) throws Exception {
if (InternalHooks.getClient() != null) {
throw new IllegalStateException("bugsnag.start() may not be called after starting Bugsnag natively");
}
JSONObject arguments = args != null ? args : new JSONObject();

Configuration configuration = args.has("apiKey")
? new Configuration(args.getString("apiKey"))
Configuration configuration = arguments.has("apiKey")
? new Configuration(arguments.getString("apiKey"))
: Configuration.load(context);

configuration.setAppType(args.optString("appType", configuration.getAppType()));
configuration.setAppVersion(args.optString("appVersion", configuration.getAppVersion()));
configuration.setAutoTrackSessions(args.optBoolean("autoTrackSessions", configuration.getAutoTrackSessions()));
configuration.setAutoDetectErrors(args.optBoolean("autoDetectErrors", configuration.getAutoDetectErrors()));
configuration.setContext(args.optString("context", configuration.getContext()));
configuration.setLaunchDurationMillis(args.optLong("launchDurationMillis", configuration.getLaunchDurationMillis()));
configuration.setSendLaunchCrashesSynchronously(args.optBoolean("sendLaunchCrashesSynchronously", configuration.getSendLaunchCrashesSynchronously()));
configuration.setMaxBreadcrumbs(args.optInt("maxBreadcrumbs", configuration.getMaxBreadcrumbs()));
configuration.setMaxPersistedEvents(args.optInt("maxPersistedEvents", configuration.getMaxPersistedEvents()));
configuration.setMaxPersistedSessions(args.optInt("maxPersistedSessions", configuration.getMaxPersistedSessions()));
configuration.setMaxStringValueLength(args.optInt("maxStringValueLength", configuration.getMaxStringValueLength()));
configuration.setReleaseStage(args.optString("releaseStage", configuration.getReleaseStage()));
configuration.setPersistUser(args.optBoolean("persistUser", configuration.getPersistUser()));

if (args.has("redactedKeys")) {
configuration.setRedactedKeys(unwrap(args.optJSONArray("redactedKeys"), new HashSet<>()));
configuration.setAppType(arguments.optString("appType", configuration.getAppType()));
configuration.setAppVersion(arguments.optString("appVersion", configuration.getAppVersion()));
configuration.setAutoTrackSessions(arguments.optBoolean("autoTrackSessions", configuration.getAutoTrackSessions()));
configuration.setAutoDetectErrors(arguments.optBoolean("autoDetectErrors", configuration.getAutoDetectErrors()));
configuration.setContext(arguments.optString("context", configuration.getContext()));
configuration.setLaunchDurationMillis(arguments.optLong("launchDurationMillis", configuration.getLaunchDurationMillis()));
configuration.setSendLaunchCrashesSynchronously(arguments.optBoolean("sendLaunchCrashesSynchronously", configuration.getSendLaunchCrashesSynchronously()));
configuration.setMaxBreadcrumbs(arguments.optInt("maxBreadcrumbs", configuration.getMaxBreadcrumbs()));
configuration.setMaxPersistedEvents(arguments.optInt("maxPersistedEvents", configuration.getMaxPersistedEvents()));
configuration.setMaxPersistedSessions(arguments.optInt("maxPersistedSessions", configuration.getMaxPersistedSessions()));
configuration.setMaxStringValueLength(arguments.optInt("maxStringValueLength", configuration.getMaxStringValueLength()));
configuration.setReleaseStage(arguments.optString("releaseStage", configuration.getReleaseStage()));
configuration.setPersistUser(arguments.optBoolean("persistUser", configuration.getPersistUser()));

if (arguments.has("redactedKeys")) {
configuration.setRedactedKeys(unwrap(arguments.optJSONArray("redactedKeys"), new HashSet<>()));
}

if (args.has("discardClasses")) {
configuration.setDiscardClasses(unwrap(args.optJSONArray("discardClasses"), new HashSet<>()));
if (arguments.has("discardClasses")) {
configuration.setDiscardClasses(unwrap(arguments.optJSONArray("discardClasses"), new HashSet<>()));
}

if (args.has("enabledReleaseStages")) {
configuration.setEnabledReleaseStages(unwrap(args.optJSONArray("enabledReleaseStages"), new HashSet<>()));
if (arguments.has("enabledReleaseStages")) {
configuration.setEnabledReleaseStages(unwrap(arguments.optJSONArray("enabledReleaseStages"), new HashSet<>()));
}

JSONObject user = args.optJSONObject("user");
JSONObject user = arguments.optJSONObject("user");
if (user != null) {
configuration.setUser(
user.optString("id", null),
Expand All @@ -136,7 +139,7 @@ Void start(@NonNull JSONObject args) throws Exception {
);
}

JSONObject endpoints = args.optJSONObject("endpoints");
JSONObject endpoints = arguments.optJSONObject("endpoints");
if (endpoints != null) {
configuration.setEndpoints(
new EndpointConfiguration(
Expand All @@ -146,7 +149,7 @@ Void start(@NonNull JSONObject args) throws Exception {
);
}

String sendThreads = args.optString("sendThreads");
String sendThreads = arguments.optString("sendThreads");
if (sendThreads.equals("always")) {
configuration.setSendThreads(ThreadSendPolicy.ALWAYS);
} else if (sendThreads.equals("unhandledOnly")) {
Expand All @@ -156,10 +159,10 @@ Void start(@NonNull JSONObject args) throws Exception {
}

configuration.setEnabledBreadcrumbTypes(
EnumHelper.unwrapBreadcrumbTypes(args.optJSONArray("enabledBreadcrumbTypes"))
EnumHelper.unwrapBreadcrumbTypes(arguments.optJSONArray("enabledBreadcrumbTypes"))
);

JSONObject enabledErrorTypes = args.optJSONObject("enabledErrorTypes");
JSONObject enabledErrorTypes = arguments.optJSONObject("enabledErrorTypes");
if (enabledErrorTypes != null) {
ErrorTypes errorTypes = new ErrorTypes();
errorTypes.setUnhandledExceptions(enabledErrorTypes.optBoolean("unhandledExceptions"));
Expand All @@ -169,23 +172,25 @@ Void start(@NonNull JSONObject args) throws Exception {
configuration.setEnabledErrorTypes(errorTypes);
}

unpackMetadata(args.optJSONObject("metadata"), configuration);
unpackMetadata(arguments.optJSONObject("metadata"), configuration);

configuration.addFeatureFlags(unpackFeatureFlags(args.optJSONArray("featureFlags")));
configuration.addFeatureFlags(unpackFeatureFlags(arguments.optJSONArray("featureFlags")));

Notifier notifier = InternalHooks.getNotifier(configuration);
JSONObject notifierJson = args.getJSONObject("notifier");
notifier.setName(notifierJson.getString("name"));
notifier.setVersion(notifierJson.getString("version"));
notifier.setUrl(notifierJson.getString("url"));
notifier.setDependencies(Collections.singletonList(new Notifier()));
if (arguments.has("notifier")) {
JSONObject notifierJson = arguments.getJSONObject("notifier");
notifier.setName(notifierJson.getString("name"));
notifier.setVersion(notifierJson.getString("version"));
notifier.setUrl(notifierJson.getString("url"));
notifier.setDependencies(Collections.singletonList(new Notifier()));
}

if (args.has("persistenceDirectory")) {
configuration.setPersistenceDirectory(new File(args.getString("persistenceDirectory")));
if (arguments.has("persistenceDirectory")) {
configuration.setPersistenceDirectory(new File(arguments.getString("persistenceDirectory")));
}

if (args.has("projectPackages")) {
JSONObject projectPackages = args.optJSONObject("projectPackages");
if (arguments.has("projectPackages")) {
JSONObject projectPackages = arguments.optJSONObject("projectPackages");

JSONArray packageNames = projectPackages.getJSONArray("packageNames");
final int packageCount = packageNames.length();
Expand All @@ -202,12 +207,12 @@ Void start(@NonNull JSONObject args) throws Exception {
configuration.setProjectPackages(packagesSet);
}

if (args.has("telemetry")) {
configuration.setTelemetry(EnumHelper.unwrapTelemetry(args.optJSONArray("telemetry")));
if (arguments.has("telemetry")) {
configuration.setTelemetry(EnumHelper.unwrapTelemetry(arguments.optJSONArray("telemetry")));
}

if (args.has("versionCode")) {
configuration.setVersionCode(args.getInt("versionCode"));
if (arguments.has("versionCode")) {
configuration.setVersionCode(arguments.getInt("versionCode"));
}

client = new InternalHooks(Bugsnag.start(context, configuration));
Expand Down Expand Up @@ -246,10 +251,15 @@ String getContext(@Nullable JSONObject args) {
return Bugsnag.getContext();
}

Void leaveBreadcrumb(@NonNull JSONObject args) throws Exception {
Bugsnag.leaveBreadcrumb(args.getString("name"),
JsonHelper.unwrap(args.getJSONObject("metaData")),
JsonHelper.unpackBreadcrumbType(args.getString("type")));
Void leaveBreadcrumb(@Nullable JSONObject args) throws Exception {
if (args != null &&
args.has("name") &&
args.has("metaData") &&
args.has("type")) {
Bugsnag.leaveBreadcrumb(args.getString("name"),
JsonHelper.unwrap(args.getJSONObject("metaData")),
JsonHelper.unpackBreadcrumbType(args.getString("type")));
}
return null;
}

Expand All @@ -268,8 +278,10 @@ Void addFeatureFlags(@Nullable JSONArray args) {
return null;
}

Void clearFeatureFlag(@NonNull JSONObject args) throws JSONException {
Bugsnag.clearFeatureFlag(args.getString("name"));
Void clearFeatureFlag(@Nullable JSONObject args) throws JSONException {
if (args != null && args.has("name")) {
Bugsnag.clearFeatureFlag(args.getString("name"));
}
return null;
}

Expand All @@ -279,7 +291,7 @@ Void clearFeatureFlags(@Nullable JSONObject args) {
}

Void addMetadata(@Nullable JSONObject args) throws JSONException {
if (args == null) {
if (args == null || !args.has("section") || !args.has("metadata")) {
return null;
}

Expand All @@ -291,7 +303,7 @@ Void addMetadata(@Nullable JSONObject args) throws JSONException {
}

Void clearMetadata(@Nullable JSONObject args) throws JSONException {
if (args == null) {
if (args == null || !args.has("section")) {
return null;
}

Expand All @@ -305,7 +317,7 @@ Void clearMetadata(@Nullable JSONObject args) throws JSONException {
}

JSONObject getMetadata(@Nullable JSONObject args) throws JSONException {
if (args == null) {
if (args == null || !args.has("section")) {
return null;
}

Expand Down Expand Up @@ -341,7 +353,7 @@ JSONObject getLastRunInfo(@Nullable Void args) throws JSONException {

@SuppressWarnings("unchecked")
JSONObject createEvent(@Nullable JSONObject args) throws JSONException {
if (args == null) {
if (args == null || !args.has("error")) {
return null;
}

Expand Down
Loading

0 comments on commit 800db33

Please sign in to comment.