Author: sshafroi
Date: 2008-06-04 09:54:44 +0200 (Wed, 04 Jun 2008)
New Revision: 6651
Modified:
trunk/search-command-control-spi/src/main/java/no/sesat/search/mode/SearchCommandFactory.java
Log:
Improved error message when a controller fails to instantiate a command with a
given configuration.
Modified:
trunk/search-command-control-spi/src/main/java/no/sesat/search/mode/SearchCommandFactory.java
===================================================================
---
trunk/search-command-control-spi/src/main/java/no/sesat/search/mode/SearchCommandFactory.java
2008-06-03 13:33:59 UTC (rev 6650)
+++
trunk/search-command-control-spi/src/main/java/no/sesat/search/mode/SearchCommandFactory.java
2008-06-04 07:54:44 UTC (rev 6651)
@@ -1,4 +1,4 @@
-/* Copyright (2006-2007) Schibsted Søk AS
+/* Copyright (2006-2008) Schibsted Søk AS
* This file is part of SESAT.
*
* SESAT is free software: you can redistribute it and/or modify
@@ -23,7 +23,9 @@
package no.sesat.search.mode;
import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
+
+import org.apache.log4j.Logger;
+
import no.schibstedsok.commons.ioc.BaseContext;
import no.schibstedsok.commons.ioc.ContextWrapper;
@@ -43,6 +45,7 @@
*/
public final class SearchCommandFactory {
+ private static final Logger LOG =
Logger.getLogger(SearchCommandFactory.class);
public interface Context extends SiteContext, BytecodeContext {}
private final Context context;
@@ -90,16 +93,10 @@
return constructor.newInstance(cxt);
- } catch (ClassNotFoundException ex) {
- throw new IllegalArgumentException(ex);
- } catch (NoSuchMethodException ex) {
- throw new IllegalArgumentException(ex);
- } catch (InvocationTargetException ex) {
- throw new IllegalArgumentException(ex);
- } catch (InstantiationException ex) {
- throw new IllegalArgumentException(ex);
- } catch (IllegalAccessException ex) {
- throw new IllegalArgumentException(ex);
}
+ catch (Exception e) {
+ LOG.fatal("Failed to instansiating controller: " + controllerName
+ " with search configuration: " + config, e);
+ throw new IllegalArgumentException(e);
+ }
}
}
_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits