Skip to content

Commit 2f1b2f1

Browse files
authored
Fix various crashes in the top-level APIs (#107)
1 parent b357e17 commit 2f1b2f1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

android-sdk/src/main/java/com/optimizely/ab/android/sdk/DataFileClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public String execute() {
8484
logger.error("Unexpected response from data file cdn, status: {}", status);
8585
return null;
8686
}
87-
} catch (IOException e) {
87+
} catch (Exception e) {
8888
logger.error("Error making request", e);
8989
return null;
9090
} finally {

android-sdk/src/main/java/com/optimizely/ab/android/sdk/OptimizelyManager.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ public OptimizelyClient initialize(@NonNull Context context, @NonNull String dat
153153
optimizelyClient = buildOptimizely(context, datafile, userProfile);
154154
} catch (ConfigParseException e) {
155155
logger.error("Unable to parse compiled data file", e);
156+
} catch (Exception e) {
157+
logger.error("Unable to build OptimizelyClient instance", e);
156158
}
157159

158160

@@ -369,12 +371,16 @@ protected void onPostExecute(UserProfile userProfile) {
369371
} else {
370372
logger.info("No listener to send Optimizely to");
371373
}
372-
} catch (ConfigParseException e) {
374+
} catch (Exception e) {
373375
logger.error("Unable to build optimizely instance", e);
374376
}
375377
}
376378
};
377-
initUserProfileTask.executeOnExecutor(executor);
379+
try {
380+
initUserProfileTask.executeOnExecutor(executor);
381+
} catch (Exception e) {
382+
logger.error("Unable to initialize the user profile while injecting Optimizely", e);
383+
}
378384
}
379385

380386
private OptimizelyClient buildOptimizely(@NonNull Context context, @NonNull String dataFile, @NonNull UserProfile userProfile) throws ConfigParseException {

0 commit comments

Comments
 (0)