Skip to content
This repository has been archived by the owner on May 3, 2018. It is now read-only.

Commit

Permalink
Allow finderless module loader construction
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlloyd committed Jul 18, 2013
1 parent c4a7beb commit 6dcdf71
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/org/jboss/modules/ModuleLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,14 @@ protected ModuleLoader() {
* @param finders the module finders to search, in order
*/
public ModuleLoader(final ModuleFinder[] finders) {
this(checkPermissions(), false, notEmpty(finders).clone());
this(checkPermissions(), false, safeClone(finders));
}

private static ModuleFinder[] notEmpty(final ModuleFinder[] finders) {
private static ModuleFinder[] safeClone(ModuleFinder[] finders) {
if (finders == null || finders.length == 0) {
throw new IllegalArgumentException("Must provide at least one module finder");
return NO_FINDERS;
}
finders = finders.clone();
for (ModuleFinder finder : finders) {
if (finder == null) {
throw new IllegalArgumentException("Module finder cannot be null");
Expand Down

0 comments on commit 6dcdf71

Please sign in to comment.