Skip to content

Commit

Permalink
Log instead of throwing parsing manifests.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjudd committed Jun 8, 2023
1 parent 26ecf64 commit 82c8224
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ public List<GlideModule> parse() {
}
}
}
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Finished loading Glide modules");
}
} catch (PackageManager.NameNotFoundException e) {
throw new RuntimeException("Unable to find metadata to parse GlideModules", e);
}
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Finished loading Glide modules");
if (Log.isLoggable(TAG, Log.ERROR)) {
Log.e(TAG, "Failed to parse glide modules", e);
}
}

return modules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,12 @@ public void parse_withNullMetadata_doesNotThrow() throws NameNotFoundException {
}

@Test
public void parse_withMissingName_throwsRuntimeException() throws NameNotFoundException {
public void parse_withMissingName_doesNotThrow() throws NameNotFoundException {
PackageManager pm = mock(PackageManager.class);
doThrow(new NameNotFoundException("name")).when(pm).getApplicationInfo(anyString(), anyInt());
when(context.getPackageManager()).thenReturn(pm);

assertThrows(
"Unable to find metadata to parse GlideModules",
RuntimeException.class,
new ThrowingRunnable() {
@Override
public void run() {
parser.parse();
}
});
parser.parse();
}

private void addModuleToManifest(Class<?> moduleClass) {
Expand Down

0 comments on commit 82c8224

Please sign in to comment.