@@ -74,7 +74,7 @@ public class DefaultModuleService extends AbstractService implements
7474 ModuleService
7575{
7676
77- @ Parameter
77+ @ Parameter ( required = false )
7878 private LogService log ;
7979
8080 @ Parameter
@@ -170,7 +170,7 @@ public Module createModule(final ModuleInfo info) {
170170 return module ;
171171 }
172172 catch (final ModuleException exc ) {
173- log .error ("Cannot create module: " + info .getDelegateClassName (), exc );
173+ if ( log != null ) log .error ("Cannot create module: " + info .getDelegateClassName (), exc );
174174 }
175175 return null ;
176176 }
@@ -251,10 +251,10 @@ public <M extends Module> M waitFor(final Future<M> future) {
251251 return future .get ();
252252 }
253253 catch (final InterruptedException e ) {
254- log .error ("Module execution interrupted" , e );
254+ if ( log != null ) log .error ("Module execution interrupted" , e );
255255 }
256256 catch (final ExecutionException e ) {
257- log .error ("Error during module execution" , e );
257+ if ( log != null ) log .error ("Error during module execution" , e );
258258 }
259259 return null ;
260260 }
@@ -392,8 +392,10 @@ private Module getRegisteredModuleInstance(final ModuleInfo info) {
392392 }
393393 if (objects .size () > 1 ) {
394394 // there are multiple instances; it's not clear which one to use
395- log .warn ("Ignoring multiple candidate module instances for class: " +
396- type .getName ());
395+ if (log != null ) {
396+ log .warn ("Ignoring multiple candidate module instances for class: " +
397+ type .getName ());
398+ }
397399 return null ;
398400 }
399401 // found exactly one instance; return it!
@@ -416,7 +418,7 @@ private Map<String, Object> createMap(final Object[] values) {
416418 final Map <?, ?> valueMap = (Map <?, ?>) values [0 ];
417419 for (final Object key : valueMap .keySet ()) {
418420 if (!(key instanceof String )) {
419- log .error ("Invalid input name: " + key );
421+ if ( log != null ) log .error ("Invalid input name: " + key );
420422 continue ;
421423 }
422424 final String name = (String ) key ;
@@ -427,7 +429,7 @@ private Map<String, Object> createMap(final Object[] values) {
427429 }
428430
429431 if (values .length % 2 != 0 ) {
430- log .error ("Ignoring extraneous argument: " + values [values .length - 1 ]);
432+ if ( log != null ) log .error ("Ignoring extraneous argument: " + values [values .length - 1 ]);
431433 }
432434
433435 // loop over list of key/value pairs
@@ -436,7 +438,7 @@ private Map<String, Object> createMap(final Object[] values) {
436438 final Object key = values [2 * i ];
437439 final Object value = values [2 * i + 1 ];
438440 if (!(key instanceof String )) {
439- log .error ("Invalid input name: " + key );
441+ if ( log != null ) log .error ("Invalid input name: " + key );
440442 continue ;
441443 }
442444 final String name = (String ) key ;
@@ -459,16 +461,18 @@ private void assignInputs(final Module module,
459461 if (input == null ) {
460462 // inputs whose name starts with a dot are implicitly known by convention
461463 if (!name .startsWith ("." )) {
462- log .warn ("Unmatched input: " + name );
464+ if ( log != null ) log .warn ("Unmatched input: " + name );
463465 }
464466 converted = value ;
465467 }
466468 else {
467469 final Class <?> type = input .getType ();
468470 converted = convertService .convert (value , type );
469471 if (value != null && converted == null ) {
470- log .error ("For input " + name + ": incompatible object " +
471- value .getClass ().getName () + " for type " + type .getName ());
472+ if (log != null ) {
473+ log .error ("For input " + name + ": incompatible object " +
474+ value .getClass ().getName () + " for type " + type .getName ());
475+ }
472476 continue ;
473477 }
474478 }
0 commit comments