--- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/FormatterDefinition.java Sun Dec 22 22:02:44 2013 +0100
+++ b/java/sql-dk/src/info/globalcode/sql/dk/configuration/FormatterDefinition.java Sun Dec 22 23:31:55 2013 +0100
@@ -21,6 +21,7 @@
import info.globalcode.sql.dk.DKException;
import info.globalcode.sql.dk.formatting.Formatter;
import info.globalcode.sql.dk.formatting.FormatterContext;
+import info.globalcode.sql.dk.formatting.FormatterException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import javax.xml.bind.annotation.XmlElement;
@@ -76,7 +77,7 @@
* @return
* @throws DKException
*/
- public Formatter getInstance(FormatterContext context) throws DKException {
+ public Formatter getInstance(FormatterContext context) throws FormatterException {
try {
Constructor constructor = Class.forName(className).getConstructor(context.getClass());
@@ -84,14 +85,14 @@
if (instance instanceof Formatter) {
return (Formatter) instance;
} else {
- throw new DKException("Formatter " + instance + " does not implement the " + Formatter.class.getName() + " interface");
+ throw new FormatterException("Formatter " + instance + " does not implement the " + Formatter.class.getName() + " interface");
}
} catch (ClassNotFoundException e) {
- throw new DKException("No formatter class with name: " + className, e);
+ throw new FormatterException("No formatter class with name: " + className, e);
} catch (NoSuchMethodException e) {
- throw new DKException("Formatter class with no valid constructor: " + className, e);
+ throw new FormatterException("Formatter class with no valid constructor: " + className, e);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
- throw new DKException("Formatter's constructor caused an error: " + className, e);
+ throw new FormatterException("Formatter's constructor caused an error: " + className, e);
}
}
}